This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 28051 - [imports]: showing <dialog> from import
Summary: [imports]: showing <dialog> from import
Status: RESOLVED MOVED
Alias: None
Product: WebAppsWG
Classification: Unclassified
Component: HISTORICAL - Component Model (show other bugs)
Version: unspecified
Hardware: PC Windows NT
: P2 normal
Target Milestone: ---
Assignee: Dimitri Glazkov
QA Contact: public-webapps-bugzilla
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 20683
  Show dependency treegraph
 
Reported: 2015-02-18 16:37 UTC by Ashley Gullen
Modified: 2015-07-06 08:13 UTC (History)
4 users (show)

See Also:


Attachments

Description Ashley Gullen 2015-02-18 16:37:51 UTC
(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.
Comment 1 Anne 2015-02-18 16:40:17 UTC
DOM is not the correct component. Component Model is.
Comment 2 Dimitri Glazkov 2015-02-18 16:53:21 UTC
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 Elliott Sprehn 2015-02-19 03:03:42 UTC
(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.
Comment 4 Hayato Ito 2015-07-06 08:13:08 UTC
Moved to https://github.com/w3c/webcomponents/issues/148