-
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
popover focus state weirdness #9152
Comments
cc @mfreed7 |
This was just discussed in Open UI. MinutesJakeA: this is something I encountered in the spec. This [shares scree] is the algorithm when the button for the popover is pressed… at some point it sets the popover's popover invoker to the button…JakeA: the popover invoker isn't then later removed, I'm not sure how bad that is? keith: it is for restoring the focus when the popover is hidden masonf: it's related to focus… in the implementation there is a previouslyfocusedelement too. The 'invoker' is used to manage order of focus JakeA: so this probably should not hang around if the popover didn't show? masonf: probably true… almost like a noop, but we probably should clean it up JakeA: if the popover is shown by some other means that doesn't change the popover invoker, it would still be there masonf: yes you're right, good catch JakeA: when I was trying to figure out what the invoker was for… I saw step 5 in the algorithm for the associated focus navigation owner… step 5 seems to be 'off' ? JakeA: it seems odd for it to return itself masonf: I think you're right, it probably should return the invoker there masonf: would need to read it a little more carefully… the relationship is … the invoker is the owner… so you should probably be returning the invoker here… we probably already do this in the Chromium implementation, otherwise it wouldn't work masonf: so it sounds like we need to fix a few issues in spec and potentially implementation too |
Per the meeting, both things seem like issues that we need to correct in both the implementation and spec, and @josepharhar and I will take a look. Thanks for raising these. |
Ok, taking a closer look at this. I'm not sure exactly which "4 early returns" you are talking about, but certainly there are cases where the attempt to invoke the popover might fail. One is the check popover validity call, but that should always pass given the pre-condition that the popover target element is non-null. However, the event handler does fire, and that could change pre-conditions and result in the popover not actually being shown. (Did I miss another condition?) This begs the question though: so what? If the I'm not sure anything needs to change here.
Double-checking the Chromium implementation, and it does appear this spec text should return the popover invoker and not the popover. The owner of a popover, for focus navigation purposes, is its invoker. (This should also resolve #9168.) @josepharhar mind putting up a quick PR to do that? |
However, the invoker is still set to the button, even though it wasn't the invoker. It feels like, at the very least, Does that make sense? |
Yep, makes total sense - that seems bad. Thanks for explaining in more detail! I think I agree that the fix is to always set |
As was pointed out in [1], if we don't reset invoker, it is possible to get into a state where a closed popover still has an invoker. The new test case in this CL shows that problem. [1] whatwg/html#9152 Bug: 1307772 Change-Id: I1511ec8f0e9e0193f0c8b5ce834d20de9d8b46e9
As was pointed out in [1], if we don't reset invoker, it is possible to get into a state where a closed popover still has an invoker. The new test case in this CL shows that problem. [1] whatwg/html#9152 Bug: 1307772 Change-Id: I1511ec8f0e9e0193f0c8b5ce834d20de9d8b46e9
Fixes whatwg#9152 If we don't reset invoker, it is possible to get into a state where a closed popover still has an invoker.
Fixes whatwg#9152 If we don't reset invoker, it is possible to get into a state where a closed popover still has an invoker.
I opened a PR: #9186 |
As was pointed out in [1], if we don't reset invoker, it is possible to get into a state where a closed popover still has an invoker. The new test case in this CL shows that problem. [1] whatwg/html#9152 Bug: 1307772 Change-Id: I1511ec8f0e9e0193f0c8b5ce834d20de9d8b46e9 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4435697 Reviewed-by: Joey Arhar <jarhar@chromium.org> Commit-Queue: Tommy Steimel <steimel@chromium.org> Code-Coverage: Findit <findit-for-me@appspot.gserviceaccount.com> Auto-Submit: Mason Freed <masonf@chromium.org> Reviewed-by: Tommy Steimel <steimel@chromium.org> Cr-Commit-Position: refs/heads/main@{#1133290}
As was pointed out in [1], if we don't reset invoker, it is possible to get into a state where a closed popover still has an invoker. The new test case in this CL shows that problem. [1] whatwg/html#9152 Bug: 1307772 Change-Id: I1511ec8f0e9e0193f0c8b5ce834d20de9d8b46e9 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4435697 Reviewed-by: Joey Arhar <jarhar@chromium.org> Commit-Queue: Tommy Steimel <steimel@chromium.org> Code-Coverage: Findit <findit-for-me@appspot.gserviceaccount.com> Auto-Submit: Mason Freed <masonf@chromium.org> Reviewed-by: Tommy Steimel <steimel@chromium.org> Cr-Commit-Position: refs/heads/main@{#1133290}
As was pointed out in [1], if we don't reset invoker, it is possible to get into a state where a closed popover still has an invoker. The new test case in this CL shows that problem. [1] whatwg/html#9152 Bug: 1307772 Change-Id: I1511ec8f0e9e0193f0c8b5ce834d20de9d8b46e9 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4435697 Reviewed-by: Joey Arhar <jarhar@chromium.org> Commit-Queue: Tommy Steimel <steimel@chromium.org> Code-Coverage: Findit <findit-for-me@appspot.gserviceaccount.com> Auto-Submit: Mason Freed <masonf@chromium.org> Reviewed-by: Tommy Steimel <steimel@chromium.org> Cr-Commit-Position: refs/heads/main@{#1133290}
As was pointed out in [1], if we don't reset invoker, it is possible to get into a state where a closed popover still has an invoker. The new test case in this CL shows that problem. [1] whatwg/html#9152 Bug: 1307772 Change-Id: I1511ec8f0e9e0193f0c8b5ce834d20de9d8b46e9 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4435697 Reviewed-by: Joey Arhar <jarhar@chromium.org> Commit-Queue: Tommy Steimel <steimel@chromium.org> Code-Coverage: Findit <findit-for-me@appspot.gserviceaccount.com> Auto-Submit: Mason Freed <masonf@chromium.org> Reviewed-by: Tommy Steimel <steimel@chromium.org> Cr-Commit-Position: refs/heads/main@{#1133290}
…r()`, a=testonly Automatic update from web-platform-tests Reset the popover invoker in `showPopover()` As was pointed out in [1], if we don't reset invoker, it is possible to get into a state where a closed popover still has an invoker. The new test case in this CL shows that problem. [1] whatwg/html#9152 Bug: 1307772 Change-Id: I1511ec8f0e9e0193f0c8b5ce834d20de9d8b46e9 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4435697 Reviewed-by: Joey Arhar <jarhar@chromium.org> Commit-Queue: Tommy Steimel <steimel@chromium.org> Code-Coverage: Findit <findit-for-me@appspot.gserviceaccount.com> Auto-Submit: Mason Freed <masonf@chromium.org> Reviewed-by: Tommy Steimel <steimel@chromium.org> Cr-Commit-Position: refs/heads/main@{#1133290} -- wpt-commits: cc0704e3a1741d28d2bef73c6e84796b7c928849 wpt-pr: 39589
Otherwise it's possible to get in a state where a shown-again popover has its initial invoker. Tests: web-platform-tests/wpt#39589. Fixes #9152.
…r()`, a=testonly Automatic update from web-platform-tests Reset the popover invoker in `showPopover()` As was pointed out in [1], if we don't reset invoker, it is possible to get into a state where a closed popover still has an invoker. The new test case in this CL shows that problem. [1] whatwg/html#9152 Bug: 1307772 Change-Id: I1511ec8f0e9e0193f0c8b5ce834d20de9d8b46e9 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4435697 Reviewed-by: Joey Arhar <jarhar@chromium.org> Commit-Queue: Tommy Steimel <steimel@chromium.org> Code-Coverage: Findit <findit-for-me@appspot.gserviceaccount.com> Auto-Submit: Mason Freed <masonf@chromium.org> Reviewed-by: Tommy Steimel <steimel@chromium.org> Cr-Commit-Position: refs/heads/main@{#1133290} -- wpt-commits: cc0704e3a1741d28d2bef73c6e84796b7c928849 wpt-pr: 39589
…r()`, a=testonly Automatic update from web-platform-tests Reset the popover invoker in `showPopover()` As was pointed out in [1], if we don't reset invoker, it is possible to get into a state where a closed popover still has an invoker. The new test case in this CL shows that problem. [1] whatwg/html#9152 Bug: 1307772 Change-Id: I1511ec8f0e9e0193f0c8b5ce834d20de9d8b46e9 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4435697 Reviewed-by: Joey Arhar <jarharchromium.org> Commit-Queue: Tommy Steimel <steimelchromium.org> Code-Coverage: Findit <findit-for-meappspot.gserviceaccount.com> Auto-Submit: Mason Freed <masonfchromium.org> Reviewed-by: Tommy Steimel <steimelchromium.org> Cr-Commit-Position: refs/heads/main{#1133290} -- wpt-commits: cc0704e3a1741d28d2bef73c6e84796b7c928849 wpt-pr: 39589 UltraBlame original commit: cea57aad3268804342d5b82c3ae3a22d51ac1e8a
…r()`, a=testonly Automatic update from web-platform-tests Reset the popover invoker in `showPopover()` As was pointed out in [1], if we don't reset invoker, it is possible to get into a state where a closed popover still has an invoker. The new test case in this CL shows that problem. [1] whatwg/html#9152 Bug: 1307772 Change-Id: I1511ec8f0e9e0193f0c8b5ce834d20de9d8b46e9 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4435697 Reviewed-by: Joey Arhar <jarharchromium.org> Commit-Queue: Tommy Steimel <steimelchromium.org> Code-Coverage: Findit <findit-for-meappspot.gserviceaccount.com> Auto-Submit: Mason Freed <masonfchromium.org> Reviewed-by: Tommy Steimel <steimelchromium.org> Cr-Commit-Position: refs/heads/main{#1133290} -- wpt-commits: cc0704e3a1741d28d2bef73c6e84796b7c928849 wpt-pr: 39589 UltraBlame original commit: cea57aad3268804342d5b82c3ae3a22d51ac1e8a
…r()`, a=testonly Automatic update from web-platform-tests Reset the popover invoker in `showPopover()` As was pointed out in [1], if we don't reset invoker, it is possible to get into a state where a closed popover still has an invoker. The new test case in this CL shows that problem. [1] whatwg/html#9152 Bug: 1307772 Change-Id: I1511ec8f0e9e0193f0c8b5ce834d20de9d8b46e9 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4435697 Reviewed-by: Joey Arhar <jarharchromium.org> Commit-Queue: Tommy Steimel <steimelchromium.org> Code-Coverage: Findit <findit-for-meappspot.gserviceaccount.com> Auto-Submit: Mason Freed <masonfchromium.org> Reviewed-by: Tommy Steimel <steimelchromium.org> Cr-Commit-Position: refs/heads/main{#1133290} -- wpt-commits: cc0704e3a1741d28d2bef73c6e84796b7c928849 wpt-pr: 39589 UltraBlame original commit: cea57aad3268804342d5b82c3ae3a22d51ac1e8a
https://bugs.webkit.org/show_bug.cgi?id=256636 Reviewed by Tim Nguyen. Address this issue: whatwg/html#9152 * LayoutTests/imported/w3c/web-platform-tests/html/semantics/popovers/popover-invoker-reset-expected.txt: Added. * LayoutTests/imported/w3c/web-platform-tests/html/semantics/popovers/popover-invoker-reset.html: Added. * Source/WebCore/html/HTMLElement.cpp: (WebCore::HTMLElement::showPopover): * Source/WebCore/html/HTMLElement.h: * Source/WebCore/html/HTMLFormControlElement.cpp: (WebCore::HTMLFormControlElement::handlePopoverTargetAction const): Canonical link: https://commits.webkit.org/264006@main
As discussed in [1], we need to reset invoker in showPopover(). If not, It's possible that a closed popover still has an invoker. [1] whatwg/html#9152 Differential Revision: https://phabricator.services.mozilla.com/D179195
As discussed in [1], we need to reset invoker in showPopover(). If not, It's possible that a closed popover still has an invoker. [1] whatwg/html#9152 Differential Revision: https://phabricator.services.mozilla.com/D179195
https://html.spec.whatwg.org/multipage/popover.html#popover-target-attribute-activation-behavior
The invoker is set, then the popover attempts to show. However, that might not succeed for a number of reasons (there are 4 early returns in the show algorithm). If this happens, the invoker is left as-is.
That means, if
showPopover()
is called later, the invoker will be incorrect.I guess
showPopover()
should clear the invoker? Or maybe it needs to be cleared earlier? It isn't really clear to me how the invoker is used.https://html.spec.whatwg.org/multipage/interaction.html#associated-focus-navigation-owner
Is that right? All of the other steps in this algorithm seem to be returning something 'parent', this is the only one that returns itself. That means that a popover's focus navigation scope is itself.
The text was updated successfully, but these errors were encountered: