Bug 282988
| Summary: | iOS Safari "click" events have the "mouse" pointerType when triggered from touch | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | zallen |
| Component: | UI Events | Assignee: | Abrar Rahman Protyasha <a_protyasha> |
| Status: | REOPENED | ||
| Severity: | Normal | CC: | a_protyasha, gsnedders, karlcow, lily_spiniolas, webkit-bug-importer |
| Priority: | P2 | Keywords: | InRadar |
| Version: | Safari 18 | ||
| Hardware: | iPhone / iPad | ||
| OS: | iOS 18 | ||
| See Also: |
https://bugs.webkit.org/show_bug.cgi?id=285901 https://bugs.webkit.org/show_bug.cgi?id=287098 |
||
| Bug Depends on: | 287098 | ||
| Bug Blocks: | |||
zallen
Safari 18.2 switched from using mouse events to pointer events for click events. However these click events are using the incorrect pointerType by reporting touches as a mouse.
Steps to reproduce:
On iOS Safari 18.2, use touch to tap on the "Target" box on https://codepen.io/zeallen/pen/ExqrgjB. Notice:
* pointerdown and pointerup both report "touch" as the pointerType (correct)
* click reports "mouse" as the pointerType (incorrect)
| Attachments | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |
Abrar Rahman Protyasha
Thanks for the bug report!
About click events, the PointerEvent spec says:
> If the events are generated by a pointing device, their pointerId and pointerType MUST be the same as the PointerEvents that caused these events.
https://w3c.github.io/pointerevents/#dfn-click-auxclick-and-contextmenu-events:~:text=If%20the%20events%20are%20generated%20by%20a%20pointing%20device%2C%20their%20pointerId%20and%20pointerType%20MUST%20be%20the%20same%20as%20the%20PointerEvents%20that%20caused%20these%20events.
We should fix this.
Radar WebKit Bug Importer
<rdar://problem/139828481>
Sam Sneddon [:gsnedders]
What led to you finding this, if I may ask?
Because, e.g., if your website has places where behaviour differs based on the pointerType of the click event (and expecting a certain degree of fine control if it is a mouse), then there's almost certainly other breakage out there.
zallen
My website had some special handling for clicks in one area due to touch not having the ability to hover, so the behavior with a mouse vs touch/pen differed. I was using the pointerType of the click event to determine what behavior to do, but I had special handling for Safari since, prior to 18.2, click events were mouse events instead of pointer events. Now that 18.2 uses pointer events, that special handling stopped being engaged, which led to incorrect behavior.
Abrar Rahman Protyasha
Pull request: https://github.com/WebKit/WebKit/pull/38976
EWS
Committed 288873@main (d1f55d9bf83b): <https://commits.webkit.org/288873@main>
Reviewed commits have been landed. Closing PR #38976 and removing active labels.
Abrar Rahman Protyasha
Reopened Bugzilla.
REGRESSION (288873@main): [ iOS ] fast/forms/switch/click-animation-twice-fast.html is a constant timeout., tracking revert in https://bugs.webkit.org/show_bug.cgi?id=287098.
Abrar Rahman Protyasha
rdar://144822509