-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Don't throw when popover/dialog is in requested state #9142
Conversation
This patch makes the following changes: - Don't throw exceptions when showPopover or hidePopover is called and the popover is already in the requested state. - Don't throw exceptions when dialog.showModal, dialog.show, or dialog.close is called and the dialog is already in the requested state. - Throw exceptions when trying to switch between modal and non-modal dialog modes via dialog.showModal or dialog.show. Fixes whatwg#9045
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.
Looks good editorially.
source
Outdated
<li><p>If <span>this</span> has an <code data-x="attr-dialog-open">open</code> attribute, then | ||
return.</p></li> | ||
throw an <span>"<code>InvalidStateError</code>"</span> <code>DOMException</code>.</p></li> |
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.
This is a new exception, how certain are we that this is web compatible?
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.
Tim convinced me that it's unlikely this will break anything.
Once this has tests and impl bugs this should be good to go. Thanks @josepharhar! |
This is being changed in the HTML spec here: whatwg/html#9142 Change-Id: Ib8aaaf314c2a1de5d082494e5172e029d531c8e8
This is being changed in the HTML spec here: whatwg/html#9142 Change-Id: Ib8aaaf314c2a1de5d082494e5172e029d531c8e8
Done |
@mfreed7 suggested that we should throw when hidePopover is called on a disconnected popover. This PR currently makes disconnected popovers stop throwing when hidePopover is called on them. Does anyone have thoughts on this? If not I'll make that case start throwing again. |
...my rationale was simply that this is a different case than calling |
I don't care strongly, though I suspect it'll be easier for people to use when there are less cases that throw, including what one might think of as erroneous cases. I'm wondering what web developers would do when they encounter the exception. Add a conditional or solve their ordering problem? If they would usually do the former, they are better served by us not throwing. Either way, this will need some rebasing. |
I resolved the conflicts, which included the current document vs expected document check, which I included in the list of conditions after the no-exception early out. |
One quick data point: nobody evaluating the popover API that I worked with encountered this issue, or at least never relayed it to me, so hopefully it's fairly corner case. My intuition is that we'll most help them by throwing. If you call |
https://bugs.webkit.org/show_bug.cgi?id=255879 Reviewed by Tim Nguyen. Implement the spec changes from: whatwg/html#9142 The dialog related changes are tested by dialog-no-throw-requested-state.html. * LayoutTests/imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-dialog-element/dialog-no-throw-requested-state-expected.txt: Added. * LayoutTests/imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-dialog-element/dialog-no-throw-requested-state.html: Added. * LayoutTests/imported/w3c/web-platform-tests/html/semantics/popovers/popover-attribute-basic.html: * LayoutTests/imported/w3c/web-platform-tests/html/semantics/popovers/popover-light-dismiss.html: * LayoutTests/imported/w3c/web-platform-tests/html/semantics/popovers/popover-move-documents.html: * LayoutTests/imported/w3c/web-platform-tests/html/semantics/popovers/resources/popover-utils.js: (async sendTab): (async sendEscape): (async sendEnter): (assertPopoverVisibility): * LayoutTests/platform/ios/imported/w3c/web-platform-tests/html/semantics/popovers/popover-light-dismiss-expected.txt: * Source/WebCore/html/HTMLDialogElement.cpp: (WebCore::HTMLDialogElement::show): (WebCore::HTMLDialogElement::showModal): * Source/WebCore/html/HTMLElement.cpp: (WebCore::checkPopoverValidity): (WebCore::HTMLElement::showPopover): (WebCore::HTMLElement::hidePopoverInternal): Canonical link: https://commits.webkit.org/263957@main
This is being changed in the HTML spec here: whatwg/html#9142 Change-Id: Ib8aaaf314c2a1de5d082494e5172e029d531c8e8
This is being changed in the HTML spec here: whatwg/html#9142 Change-Id: Ib8aaaf314c2a1de5d082494e5172e029d531c8e8
This is being changed in the HTML spec here: whatwg/html#9142 Change-Id: Ib8aaaf314c2a1de5d082494e5172e029d531c8e8 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4494823 Reviewed-by: Mason Freed <masonf@chromium.org> Commit-Queue: Joey Arhar <jarhar@chromium.org> Cr-Commit-Position: refs/heads/main@{#1144952}
This is being changed in the HTML spec here: whatwg/html#9142 Change-Id: Ib8aaaf314c2a1de5d082494e5172e029d531c8e8 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4494823 Reviewed-by: Mason Freed <masonf@chromium.org> Commit-Queue: Joey Arhar <jarhar@chromium.org> Cr-Commit-Position: refs/heads/main@{#1144952}
This is being changed in the HTML spec here: whatwg/html#9142 Change-Id: Ib8aaaf314c2a1de5d082494e5172e029d531c8e8 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4494823 Reviewed-by: Mason Freed <masonf@chromium.org> Commit-Queue: Joey Arhar <jarhar@chromium.org> Cr-Commit-Position: refs/heads/main@{#1144952}
…e in requested state, a=testonly Automatic update from web-platform-tests Don't throw when popovers and dialogs are in requested state This is being changed in the HTML spec here: whatwg/html#9142 Change-Id: Ib8aaaf314c2a1de5d082494e5172e029d531c8e8 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4494823 Reviewed-by: Mason Freed <masonf@chromium.org> Commit-Queue: Joey Arhar <jarhar@chromium.org> Cr-Commit-Position: refs/heads/main@{#1144952} -- wpt-commits: 0297d56d41123bb302ed3fdc84ec4f0fa891c4bf wpt-pr: 39781
…e in requested state, a=testonly Automatic update from web-platform-tests Don't throw when popovers and dialogs are in requested state This is being changed in the HTML spec here: whatwg/html#9142 Change-Id: Ib8aaaf314c2a1de5d082494e5172e029d531c8e8 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4494823 Reviewed-by: Mason Freed <masonf@chromium.org> Commit-Queue: Joey Arhar <jarhar@chromium.org> Cr-Commit-Position: refs/heads/main@{#1144952} -- wpt-commits: 0297d56d41123bb302ed3fdc84ec4f0fa891c4bf wpt-pr: 39781
…e. r=emilio Update to be in line with spec discussions at whatwg/html#9142 Differential Revision: https://phabricator.services.mozilla.com/D178782
…e. r=emilio Update to be in line with spec discussions at whatwg/html#9142 Differential Revision: https://phabricator.services.mozilla.com/D178782
…e. r=emilio Update to be in line with spec discussions at whatwg/html#9142 Differential Revision: https://phabricator.services.mozilla.com/D178782 UltraBlame original commit: 39007d3d4f3eee8382115fb59e595de006ceca70
…e. r=emilio Update to be in line with spec discussions at whatwg/html#9142 Differential Revision: https://phabricator.services.mozilla.com/D178782 UltraBlame original commit: 39007d3d4f3eee8382115fb59e595de006ceca70
…e. r=emilio Update to be in line with spec discussions at whatwg/html#9142 Differential Revision: https://phabricator.services.mozilla.com/D178782 UltraBlame original commit: 39007d3d4f3eee8382115fb59e595de006ceca70
Assuming this is an edge-case, with unclear developer benefit, consistency with @emilio: what's your view on this? CC @mfreed7
|
CC @josepharhar |
What exactly are you proposing?
On a disconnected popover:
|
To let
Then those three methods all throw, hence, are consistent. |
Ok, yeah I suppose that making hidePopover throw on a disconnected popover doesnt necessarily go against the original motivation of the issue that this PR fixed, so I'm ok with making it throw again |
The current setup is consistent with dialog fwiw, |
Yeah, there's a difference between not being able to show and hiding no-opping. This was discussed in one of the many issues. |
Thanks for pointing that out. Be aware that Consistency within the popover API seems preferable, or? |
You can't really change the tagname for |
True.
|
Presumably you mean #9142 (comment) and previous comments. I lack the experience of what web-developers actually prefer. As there are arguments for both behaviors, throwing and not throwing, let's leave the API in the current state. |
This patch makes the following changes:
Fixes #9045
(See WHATWG Working Mode: Changes for more details.)
/interactive-elements.html ( diff )
/popover.html ( diff )