This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.
(Submitted as a followup from crbug.com/458799 and public-webapps@w3.org email) It appears if a <dialog> is defined in a HTML import, calling showModal() attempts to show it in the HTML import's document, which is not visible. It would probably be more useful to show it on the main document. Use case: a web component is used via a HTML import, and the component wants to show a dialog at some point. Naturally the dialog will be defined in the component's import, but calling showModal() will not actually cause the dialog to be visible to the user. Workaround: using JS code, the component can detach its <dialog> from the import document and append it to the main document. Then it can be shown as expected. However this probably ought to happen automatically or not be necessary. Suggested possible resolutions: #1) if a dialog is not in the main document, when shown it must be detached and appended to the main document, and when closed detached and reinserted back to its HTML import #2) allow a dialog to be shown in a HTML import document, but have it work the same as #1 by some other means (automagic?) #3) explicitly specify that the current behavior is how it is intended to work with HTML imports, and note that frameworks are expected to use a workaround (e.g. #1 via JS code). I would prefer resolution #1 since that's just getting the browser to do what any JS framework would do to work around this.
DOM is not the correct component. Component Model is.
The showModal steps in https://html.spec.whatwg.org/multipage/forms.html#dom-dialog-showmodal set a flag on a document (the imported document: http://w3c.github.io/webcomponents/spec/imports/#dfn-imported-document), and since an imported doc is not rendered, there's no way to reset that flag (https://html.spec.whatwg.org/multipage/interaction.html#blocked-by-a-modal-dialog). That seems bad.
(In reply to Dimitri Glazkov from comment #2) > The showModal steps in > https://html.spec.whatwg.org/multipage/forms.html#dom-dialog-showmodal set a > flag on a document (the imported document: > http://w3c.github.io/webcomponents/spec/imports/#dfn-imported-document), and > since an imported doc is not rendered, there's no way to reset that flag > (https://html.spec.whatwg.org/multipage/interaction.html#blocked-by-a-modal- > dialog). That seems bad. There's no concept of style/layout/paint in import documents. If you want to display a <dialog> put it in the visible document.
Moved to https://github.com/w3c/webcomponents/issues/148