[Webkit-unassigned] [Bug 234077] New: [selectors] :focus-visible not matching on accessKey focus after focusing something via mouse

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Dec 9 05:44:31 PST 2021


https://bugs.webkit.org/show_bug.cgi?id=234077

            Bug ID: 234077
           Summary: [selectors] :focus-visible not matching on accessKey
                    focus after focusing something via mouse
           Product: WebKit
           Version: WebKit Nightly Build
          Hardware: Unspecified
                OS: Unspecified
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: CSS
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: rego at igalia.com
                CC: koivisto at iki.fi
            Blocks: 185859

We've a problem in :focus-visible implementation, when we call Element::focus() if we had previously focused something via mouse click, we might not be setting "FocusVisibility::Visible" for things that are expected to have it.

Example:
  <div tabindex="0">foo</div>
  <div tabindex="0" accessKey="B">bar</div>

If you first focus the "foo" element via mouse click, and then use "Alt+B" to focus the "bar" element, the "bar" element doesn't match :focus-visible, when it should.
The problem is that by default when you use "Alt+B", document->wasLastFocusByClick() is FALSE, so we set FocusVisibility::Visible manually in Element::focus(). But when we do that after clicking a focusable element, document->wasLastFocusByClick() is TRUE so we don't set FocusVisibility::Visible.

We should always match :focus-visible in the "bar" element in when accessing it with the accessKey.


JFYI, we were experiencing a similar issue before the patch on bug #233924 for SELECT element.


Referenced Bugs:

https://bugs.webkit.org/show_bug.cgi?id=185859
[Bug 185859] [selectors] Support for Focus-Indicated Pseudo-class: `:focus-visible`
-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20211209/df2a2e49/attachment.htm>


More information about the webkit-unassigned mailing list