mirror of
https://github.com/l0ng-ai/openidea.git
synced 2026-11-08 08:52:12 +00:00
On macOS, while an editable element has focus and a third-party input method (reproduced with WeChat's WeType) is active, WebKit can deliver a tap as pointerup, mouseup, pointerdown, mousedown (WebKit bug 219670). The tap's click is lost, and because the engine still considers the button down, the next tap starts with a bare mousedown and no pointerdown. Taps on tree rows, tabs and tool window buttons needed a second tap. A press stamped no later than the pointerup just before it is a reordered tap: the shim finishes it with a synthetic pointerup, mouseup and click (and dblclick for a double) after the page's handlers ran, and dispatches the skipped pointerdown when a primary mouse press arrives with no pointer down. The next tap's own click is kept. Installed on macOS only; untrusted events and other pointer types are ignored. Verified in a WKWebView with WeType, alternating taps on two targets: main 19/20 taps clicked their target, with this change 20/20, every press ran the pointerdown handlers and setPointerCapture worked; with the ABC layout the shim dispatches nothing. Refs #760, #724 Co-authored-by: ntbang0901 <[email protected]>