Bug 267008

Summary: REGRESSION(268459@main): PointerEvent pointerup `button` value does not match pointerdown
Product: WebKit Reporter: Simon Sarris <simon.sarris>
Component: UI EventsAssignee: Abrar Rahman Protyasha <a_protyasha>
Status: RESOLVED FIXED    
Severity: Normal CC: a_protyasha, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: Safari 17   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://github.com/web-platform-tests/wpt/pull/44124
Attachments:
Description Flags
Reproducible example none

Description Simon Sarris 2024-01-02 16:06:21 PST
Created attachment 469266 [details]
Reproducible example

This is a regression. All browsers (and Safari used to) match PointerEvent.button for corresponding pointerdown and pointerup events.

This means that a right click will be button = 2 for the pointerdown, but button = 0 for pointerup. This will break JavaScript that expects to do right-click events on pointerup.

A very basic reproducible example is attached. Allegedly this worked correctly in Safari 16.5 (I have not tested) but now fails in 17.2.1 (I have tested).
Comment 1 Radar WebKit Bug Importer 2024-01-03 11:03:36 PST
<rdar://problem/120429508>
Comment 2 Abrar Rahman Protyasha 2024-01-03 12:32:59 PST
Thanks for the bug report -- I suspect this is related to the changes introduced for webkit.org/b/262109 or webkit.org/b/262089 (or both). Investigating.
Comment 3 Abrar Rahman Protyasha 2024-01-18 13:37:20 PST
Works: 268458@main
Fails: 268459@main

So, the regression point is 268459@main, which makes sense given the nature of the change. It looks like some state in PointerCaptureController is broken, which I will investigate shortly.
Comment 4 Abrar Rahman Protyasha 2024-01-19 12:15:08 PST
Pull request: https://github.com/WebKit/WebKit/pull/22988
Comment 5 EWS 2024-01-20 05:18:39 PST
Committed 273263@main (29875ec3a594): <https://commits.webkit.org/273263@main>

Reviewed commits have been landed. Closing PR #22988 and removing active labels.
Comment 6 Abrar Rahman Protyasha 2024-01-22 11:25:18 PST
Submitted web-platform-tests pull request: https://github.com/web-platform-tests/wpt/pull/44124