Re: Showing <dialog> from HTML import

Can you file a spec bug?

https://www.w3.org/Bugs/Public/enter_bug.cgi?comment=&blocked=20683&short_desc=%5Bimports%5D%3A%20&product=WebAppsWG&import=import%20Model

:DG<

On Wed, Feb 18, 2015 at 5:18 AM, Ashley Gullen <ashley@scirra.com> wrote:

> I filed crbug.com/458799 for Chrome recently since showing a <dialog>
> defined in a HTML import did not work as I thought it should. I can't
> compare to any other browsers since right now AFAIK Chrome is the only
> browser shipping both HTML imports and <dialog>. There seemed to be some
> confusion from the browser developers over what the spec says ought to
> happen.
>
> It sounds like the current spec says that showing a dialog marks the "node
> document" of the dialog as being blocked. I would imagine a <dialog> in a
> HTML import has the invisible HTML import document as the node document of
> the <dialog>. Therefore it never appears on-screen (in the main document)
> when you call showModal(), but still throws if you try to open it twice.
>
> It can be worked around with JS: the dialog element can be detached from
> its current document and appended to the main document, and then
> showModal() works as expected.
>
> I think the spec may need to be altered. I think it's an obvious use case
> that a web component may want to show a dialog, and naturally that dialog
> will be defined in one of the web component's HTML imports. As it stands
> though the dialog will never appear unless the JS hack is used. I can also
> foresee that a large codebase making use of lots of dialogs ends up with
> loads of dialogs appended to the main document, instead of leaving them in
> the components where they came from.
>
> Not sure how this would be specified though - perhaps the dialog should be
> attached to the main document in showModal(), then re-inserted where it
> came from in close()? Sounds like a bit of a hack in itself...
>
> Ashley
>
>

Received on Wednesday, 18 February 2015 15:30:28 UTC