Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 3f870e3c86093101519942d201c91d352842a0d8
https://github.com/WebKit/WebKit/commit/3f870e3c86093101519942d201c91d352842a0d8
Author: Richard Robinson <[email protected]>
Date: 2026-06-29 (Mon, 29 Jun 2026)
Changed paths:
M Source/WebKit/UIProcess/mac/WKAppKitGestureController.mm
M Tools/TestWebKitAPI/Helpers/cocoa/Foundation+Extras.swift
M Tools/TestWebKitAPI/Helpers/cocoa/WebPage+JavaScriptExpression.swift
M Tools/TestWebKitAPI/Tests/WebKit/WebPage/AppKit Gesture
Tests/BasicAppKitGesturesTests.swift
Log Message:
-----------
[AppKit Gestures] Clicking on select controls causes the menu to immediately
disappear
https://bugs.webkit.org/show_bug.cgi?id=318080
rdar://177199226
Reviewed by Abrar Rahman Protyasha.
For a single click, WKAppKitGestureRecognizer recognizes its single-click
and mouse-tracking gesture recognizers simultaneously. The mouse-tracking
recognizer synthesizes a real mouse down/up pair as soon as the event
registers movement, while the single-click recognizer drives the deferred
synthetic click that ends in WebPage::completeSyntheticClick. Both paths
delivered a mouse down for the same event.
Because HTMLSelectElement::menuListDefaultEventHandler toggles the menu on
every mouse down — opening it when hidden and hiding it when shown — the
first mouse down opened the popup and the second toggled it shut, sending a
HidePopupMenu message back to the UI process.
The intended contract (309295@main) is that either the mouse-tracking
path or the synthetic click path delivers a mouse down for a given
interaction, but never both. That contract was not enforced for a stationary
event.
Restore the invariant in the mouse-tracking recognizer: while the event
stays within the single-click recognizer's allowable movement it is a
click, so defer to the synthetic click path and do not synthesize a mouse
down (nor the mouse dragged that follows it). Only once movement exceeds
that threshold — at which point the single-click recognizer cancels and
the interaction becomes a drag — does mouse tracking take over event
delivery. Using the single-click recognizer's own allowable movement as
the boundary keeps the hand-off aligned with the point at which that
recognizer cancels, so exactly one path delivers a mouse down for any
interaction. The synthetic click path continues to produce the DOM
pointer and click events for a mouse event.
Test: Tools/TestWebKitAPI/Tests/WebKit/WebPage/AppKit Gesture
Tests/BasicAppKitGesturesTests.swift
* Source/WebKit/UIProcess/mac/WKAppKitGestureController.mm:
(-[WKAppKitGestureController mouseTrackingGestureRecognized:]):
The actual fix
* Tools/TestWebKitAPI/Helpers/cocoa/Foundation+Extras.swift:
* Tools/TestWebKitAPI/Helpers/cocoa/WebPage+JavaScriptExpression.swift:
Testing infra support
* Tools/TestWebKitAPI/Tests/WebKit/WebPage/AppKit Gesture
Tests/BasicAppKitGesturesTests.swift:
The test
Canonical link: https://commits.webkit.org/316097@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications