-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Add attribute changed steps to dialog element #10954
base: main
Are you sure you want to change the base?
Conversation
b33a63f
to
21886e7
Compare
This test would also pass if we removed the assert, i.e. fixed the regression introduced recently. Marking "do not merge yet" until we get more clarity in #10953 as to what the right path forward is. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removing "do not merge yet" as I'm convinced by the arguments in #10953, but of course we still need to check all the boxes to merge.
For the tests box, could you point to more tests that enforce this behavior that aren't crash tests? Since assertions are actually comments; they don't cause crashes.
I've opened web-platform-tests/wpt#50393 which fails in a browser which follows the current spec:
|
6cc5176
to
1eca429
Compare
Have rebased with Keith's changes hopefully it's where its needed as of the new model. I think this just needs Implementer interest. I believe whatwg needs someone appointed by the projects to provide a position, so me for WebKit and Keith for Firefox wouldn't be enough. (Cc @smaug---- and @annevk ) |
Per https://issues.chromium.org/issues/384549097 I've changed the new assertion within set the dialog close watcher to be an early return as it's possible that this scenario happens in legitimate cases (see the issue for more detail). |
When the dialogs open attribute is removed: 1. Remove dialog from the document's open dialogs list. 2. Destroy and nullify dialog's close watcher This also adds an assertion to the start of 'set the dialog close watcher' that dialog's close watcher is null.
645374f
to
376c837
Compare
FYI, see comments at #10953 (comment) and after. |
Address review comments
@@ -62178,6 +62210,9 @@ interface <dfn interface>HTMLDialogElement</dfn> : <span>HTMLElement</span> { | |||
element <var>dialog</var>:</p> | |||
|
|||
<ol> | |||
<li><p>If <span>dialog</span>'s <span data-x="dialog-close-watcher">close watcher</span> is not |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to work out if we actually still need this. It's in Chromium atm but based on other changes may no longer be needed (instead can be replaced with an assert)
This has been updated to account for changes per discussions at whatnot, above and in the Chromium CL. TLDR we now handle adding the open attribute and removing it slightly more gracefully. This should fix various assertions being hit aswell as requestClose being broken. I've left open dialogs list as a list in spec despite it being a set in Chromium, the various assertions should ensure this isn't an observable difference (happy to make that change if it's desired?). |
Pending approval from a second implementor this should be ready to go (aside from editorial remarks). Though it would be good for @mfreed7 to check my homework. |
Add attribute changed steps to dialog element
When the dialogs open attribute is removed:
When the dialogs open attribute is added:
This fixes spec issues that can lead to assertions being hit but also incorrect behaviour. This also fixes closedby not working as expected for initially open dialogs.
Fixes #10953 and #10982
This behaviour is already enforced by multiple Web platform tests. e.g. https://wpt.live/html/semantics/interactive-elements/the-dialog-element/dialog-remove-open-attr-crash.html
Added better test coverage for requestClose and initially open dialogs: Add
requestClose()
subtests for initially open dialog web-platform-tests/wpt#50432https://wpt.live/html/semantics/interactive-elements/the-dialog-element/dialog-closedby-start-open.html - Added by Chromium change
Added a new test that doesn't rely on Assertions: Add test for dialog attribute changed steps web-platform-tests/wpt#50393
(See WHATWG Working Mode: Changes for more details.)
/interactive-elements.html ( diff )