Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initially open dialog with closedby can be broken #10982

Open
lukewarlow opened this issue Feb 2, 2025 · 2 comments
Open

Initially open dialog with closedby can be broken #10982

lukewarlow opened this issue Feb 2, 2025 · 2 comments
Labels
topic: dialog The <dialog> element

Comments

@lukewarlow
Copy link
Member

What is the issue with the HTML Standard?

Given the following markup:

<dialog open closedby="any">
  Dialog
</dialog>

The expected behaviour of a developer will probably be that the dialog is opened and supports close requests and light dismiss to close the open dialog. However, this is not the case.

The dialog won't be added to the document's open dialogs list nor will the dialog's close watcher be established. So the closedby attribute will have effectively no effect.

This also has the effect that calling requestClose() on a dialog in this state, would fail the assetion on step 2 that it's close watcher is not null.

Assertions are comments but this does mean step 6 is a null reference exception.

@lukewarlow lukewarlow added the topic: dialog The <dialog> element label Feb 2, 2025
@lukewarlow
Copy link
Member Author

Potentially closedby not working for initially open dialogs is fine? Correct me if I'm wrong but dialog focusing steps don't seem to run in this circumstance either.

But even if that's the case we need to update requestClose() to gracefully allow this scenario. We have 3 options there, either early return, throw, or call close directly?

@domenic
Copy link
Member

domenic commented Feb 3, 2025

I think it would be best if we made this work, including establishing a close watcher. If you have two of them in a row, they would get grouped so that a single Esc key closes them all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: dialog The <dialog> element
Development

No branches or pull requests

2 participants