Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: e0da60a6b610ee845bafefa0817c2115647b7c08
      
https://github.com/WebKit/WebKit/commit/e0da60a6b610ee845bafefa0817c2115647b7c08
  Author: Pascoe <[email protected]>
  Date:   2026-05-08 (Fri, 08 May 2026)

  Changed paths:
    A 
LayoutTests/fast/overflow/scrollbar-click-does-not-blur-focused-input-expected.txt
    A LayoutTests/fast/overflow/scrollbar-click-does-not-blur-focused-input.html
    M Source/WebCore/page/EventHandler.cpp
    M Source/WebCore/page/EventHandler.h

  Log Message:
  -----------
  Clicking an overflow element's scrollbar should not blur the focused element
https://bugs.webkit.org/show_bug.cgi?id=239524
rdar://92367314

Reviewed by Aditya Keerthi.

When an input was focused and the user clicked the scrollbar of an unrelated
overflow element (e.g. a typeahead suggestions list on linkedin.com), WebKit
cleared focus to the body. Chrome and Firefox preserve focus. No spec
constrains this -- HTML doesn't classify scrollbars as focusable areas and
CSSOM-View's elementFromPoint excludes them -- so the behavior is
implementation-defined and we should match the cross-browser convention.

EventHandler::dispatchMouseEvent already had the right check from bug 96335,
but its isInsideScrollbar() helper did a second Document-level hit test that
could see a different world than the press hit test, because
passMousePressEventToScrollbar() runs in between and can flip an overlay
scrollbar's shouldParticipateInHitTesting() state. handleMousePressEvent
already records the press scrollbar in m_lastScrollbarUnderMouse via
scrollbarForMouseEvent, which detects both frame and overflow scrollbars
and runs before any handler can mutate scrollbar state. Read that cached
value directly. isInsideScrollbar() is now redundant and is removed.

Cases with a mouse-focusable click ancestor (tabindex / contenteditable /
textarea / select) still move focus, preserving the existing
scrollbar-click-retains-focus.html test.

Test: fast/overflow/scrollbar-click-does-not-blur-focused-input.html

* 
LayoutTests/fast/overflow/scrollbar-click-does-not-blur-focused-input-expected.txt:
 Added.
* LayoutTests/fast/overflow/scrollbar-click-does-not-blur-focused-input.html: 
Added.
* Source/WebCore/page/EventHandler.cpp:
(WebCore::EventHandler::dispatchMouseEvent): Use m_lastScrollbarUnderMouse 
instead of isInsideScrollbar().
(WebCore::EventHandler::isInsideScrollbar const): Deleted.
* Source/WebCore/page/EventHandler.h:

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



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

Reply via email to