Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: a1678ffa5ff18d2173b0f871d794ba57b34d7efd
https://github.com/WebKit/WebKit/commit/a1678ffa5ff18d2173b0f871d794ba57b34d7efd
Author: Karl Dubost <[email protected]>
Date: 2026-08-07 (Fri, 07 Aug 2026)
Changed paths:
A
LayoutTests/fast/selectors/focus-visible-script-focus-after-dialog-dismiss-expected.txt
A
LayoutTests/fast/selectors/focus-visible-script-focus-after-dialog-dismiss.html
A
LayoutTests/fast/selectors/focus-visible-script-focus-inside-focused-ancestor-expected.txt
A
LayoutTests/fast/selectors/focus-visible-script-focus-inside-focused-ancestor.html
M Source/WebCore/page/EventHandler.cpp
Log Message:
-----------
REGRESSION(311768@main): :focus-visible incorrectly shown after focus()
inside a focused ancestor
https://bugs.webkit.org/show_bug.cgi?id=321157
rdar://181570771
Reviewed by Abrar Rahman Protyasha.
Buttons are not mouse-focusable on macOS/iOS, so a workaround records
that the last focus trigger was a click. 311768@main stopped that
workaround from running when the clicked button sits inside an ancestor
that can take focus, such as a <dialog>. Usually the ancestor is focused
instead and the click is recorded there, but not when it is already
focused. Nothing recorded the click, so the programmatic focus() that
followed showed :focus-visible.
music.apple.com opens its now-playing player as a <dialog>. Dismissing
it left a red focus ring on the mini player.
Walk the ancestors only up to the element that will be focused, instead
of skipping the workaround whenever there is one.
Tests: fast/selectors/focus-visible-script-focus-after-dialog-dismiss.html
fast/selectors/focus-visible-script-focus-inside-focused-ancestor.html
*
LayoutTests/fast/selectors/focus-visible-script-focus-after-dialog-dismiss-expected.txt:
Added.
*
LayoutTests/fast/selectors/focus-visible-script-focus-after-dialog-dismiss.html:
Added.
*
LayoutTests/fast/selectors/focus-visible-script-focus-inside-focused-ancestor-expected.txt:
Added.
*
LayoutTests/fast/selectors/focus-visible-script-focus-inside-focused-ancestor.html:
Added.
* Source/WebCore/page/EventHandler.cpp:
(WebCore::EventHandler::dispatchMouseEvent):
Canonical link: https://commits.webkit.org/318775@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications