Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: cde532e2aee67f1878a4ca34f4476545988dfb29
      
https://github.com/WebKit/WebKit/commit/cde532e2aee67f1878a4ca34f4476545988dfb29
  Author: Karl Dubost <[email protected]>
  Date:   2026-04-22 (Wed, 22 Apr 2026)

  Changed paths:
    A 
LayoutTests/fast/selectors/focus-visible-script-focus-from-click-expected.txt
    A LayoutTests/fast/selectors/focus-visible-script-focus-from-click.html
    M Source/WebCore/page/EventHandler.cpp

  Log Message:
  -----------
  :focus-visible incorrectly shown after programmatic focus() when trigger 
button has child elements
https://bugs.webkit.org/show_bug.cgi?id=278019
rdar://134337357

Reviewed by Ryosuke Niwa.

On macOS/iOS, buttons are not mouse-focusable. A workaround records
that the last focus trigger was a click, so that a subsequent
programmatic focus() call hides :focus-visible. However, the
workaround only checked the innermost element under the mouse. When
a button has child elements (e.g. <button><div>text</div></button>),
the hit-test target is the <div>, not the <button>, so the workaround
did not fire and :focus-visible incorrectly appeared.

Walk up from the hit-test target to find a non-mouse-focusable form
control ancestor instead of only checking the innermost element.

Test: fast/selectors/focus-visible-script-focus-from-click.html

* 
LayoutTests/fast/selectors/focus-visible-script-focus-from-click-expected.txt: 
Added.
* LayoutTests/fast/selectors/focus-visible-script-focus-from-click.html: Added.
* Source/WebCore/page/EventHandler.cpp:
(WebCore::EventHandler::dispatchMouseEvent):

Canonical link: https://commits.webkit.org/311768@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to