[Webkit-unassigned] [Bug 278019] New: Calling element.focus() from an event listener can show :focus-visible styles

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Aug 13 06:07:52 PDT 2024


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

            Bug ID: 278019
           Summary: Calling element.focus() from an event listener can
                    show :focus-visible styles
           Product: WebKit
           Version: Safari Technology Preview
          Hardware: Unspecified
                OS: Unspecified
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: CSS
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: nikita.ourazbaev at gmail.com
                CC: koivisto at iki.fi

Created attachment 472136

  --> https://bugs.webkit.org/attachment.cgi?id=472136&action=review

Screen recording of bug on iPad

When element.focus() is called from a button's event listener, whether the focused element matches the :focus-visible selector depends on whether the event’s target element has child nodes.

If the button has child nodes, :focus-visible styles will be shown.
If the button doesn't have child nodes and only contains text, :focus-visible styles will not be shown.
If the button has child nodes but they have pointer-events: none; applied, :focus-visible styles will not be shown.

Expected behaviour is that regardless of the button's contents, :focus-visible styles should not be shown if button is pressed with touch or with a mouse pointer. 

This happens on iPhone, on the Mac, and on iPad.

https://codepen.io/magiclantern/pen/KKjyWBB/8549ed2ce5fdd141e59a3dae28cbacfb

Potentially related to https://bugs.webkit.org/show_bug.cgi?id=243289

-- 
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/20240813/0e53ec0f/attachment.htm>


More information about the webkit-unassigned mailing list