[webcomponents] [imports]: showing <dialog> from import (bugzilla: 28051) (#148)

Title: [imports]: showing <dialog> from import (bugzilla: 28051)

Migrated from: https://www.w3.org/Bugs/Public/show_bug.cgi?id=28051

----
comment: 0
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=28051#c0
*Ashley Gullen* wrote on 2015-02-18 16:37:51 +0000.

(Submitted as a followup from crbug.com/458799 and public-webapps@w3-(this-is-inserted-to-avoid-notification-in-migration).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.

----

comment: 1
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=28051#c1
*Anne* wrote on 2015-02-18 16:40:17 +0000.

DOM is not the correct component. Component Model is.

----

comment: 2
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=28051#c2
*Dimitri Glazkov* wrote on 2015-02-18 16:53:21 +0000.

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.

----

comment: 3
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=28051#c3
*Elliott Sprehn* wrote on 2015-02-19 03:03:42 +0000.

(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.

---
Reply to this email directly or view it on GitHub:
https://github.com/w3c/webcomponents/issues/148

Received on Monday, 6 July 2015 07:36:54 UTC