-
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
Make togglePopover return a boolean #9393
Conversation
This PR makes togglePopover return true if it opens the popover or false if it closes it. Fixes whatwg#9043
Looks good, may be worth fixing #8999 as well. |
source
Outdated
@@ -82665,10 +82666,14 @@ dictionary <dfn dictionary>DragEventInit</dfn> : <span>MouseEventInit</span> { | |||
<li><p>If <span>this</span>'s <span>popover visibility state</span> is <span | |||
data-x="popover-showing-state">showing</span>, and <var>force</var> is not present or false, then | |||
run the <span>hide popover algorithm</span> given <span>this</span>, true, true, and | |||
true.</p></li> | |||
true, then return false.</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.
Can we not end up in a situation where hide returns early without changing the state? E.g., if hide all popovers made some changes.
I think we have to return something at the end based on the current state, instead. This might need test coverage too as @rwlbuis's WebKit implementation didn't catch this. (Assuming I'm correct.)
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.
Ok, I made it return whether the popover is actually open instead of just returning true or false or force, and I updated the WPT
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.
Thanks, this looks a lot safer. Looks good modulo nit.
https://bugs.webkit.org/show_bug.cgi?id=257769 Reviewed by Tim Nguyen. Implement togglePopover API change: whatwg/html#9393 * LayoutTests/imported/w3c/web-platform-tests/html/semantics/popovers/togglePopover-expected.txt: Added. * LayoutTests/imported/w3c/web-platform-tests/html/semantics/popovers/togglePopover.html: Added. * Source/WebCore/html/HTMLElement.cpp: (WebCore::HTMLElement::togglePopover): * Source/WebCore/html/HTMLElement.h: * Source/WebCore/html/HTMLElement.idl: Canonical link: https://commits.webkit.org/265064@main
@josepharhar would you be willing to update OP and address the nit? No need for a WebKit bug. |
Done |
https://bugs.webkit.org/show_bug.cgi?id=257769 Reviewed by Tim Nguyen. Implement togglePopover API change: whatwg/html#9393 * LayoutTests/imported/w3c/web-platform-tests/html/semantics/popovers/togglePopover-expected.txt: Added. * LayoutTests/imported/w3c/web-platform-tests/html/semantics/popovers/togglePopover.html: Added. * Source/WebCore/html/HTMLElement.cpp: (WebCore::HTMLElement::togglePopover): * Source/WebCore/html/HTMLElement.h: * Source/WebCore/html/HTMLElement.idl: Canonical link: https://commits.webkit.org/265064@main
This PR makes togglePopover return true if it opens the popover or false if it closes it.
Fixes #9043
(See WHATWG Working Mode: Changes for more details.)
/dom.html ( diff )
/popover.html ( diff )