Bug 232545

Summary: touch-action: pan-y does not prevent scrolling with initial horizontal panning
Product: WebKit Reporter: Robert Flack <flackr>
Component: ScrollingAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Normal CC: graouts, pfg.webkit, simon.fraser, steffen.weber, webkit-bug-importer, wenson_hsieh
Priority: P2 Keywords: InRadar
Version: Safari 15   
Hardware: Unspecified   
OS: Unspecified   

Description Robert Flack 2021-10-31 09:52:38 PDT
In chrome or firefox, touch-action: pan-y implies that if the user initially swipes left or right, any subsequent vertical panning should be ignored. This also is covered by the pointer-events spec: https://w3c.github.io/pointerevents/#determining-supported-direct-manipulation-behavior as follows: "Similarly, in the case of the various touch-action values of pan-*, once the user agent has determined whether to handle a gesture directly or not at the start of the gesture, a subsequent change in the direction of the same gesture SHOULD be ignored by the user agent for as long as that pointer is active. For instance, if an element has been set to touch-action: pan-y (meaning that only vertical panning is handled by the user agent), and a touch gesture starts off horizontally, no vertical panning should occur if the user changes the direction of their gesture to be vertical while their finger is still touching the screen."

However, in safari it seems that if the page is not horizontally scrollable the user can start swiping horizontally on a touch-action: pan-y element and then switch to vertical scrolling. Further, it doesn't take much of a vertical movement to initiate this vertical scroll making it extremely likely to accidentally trigger on a horizontal swipe. This makes it hard for developers to use to handle directional gestures.

To reproduce the issue, load the following test page https://output.jsbin.com/wivahef/

Start a swipe on the touch-action: pan-y box moving horizontally at first and then vertically. This should not scroll the page.

However, if the page is horizontally scrollable, e.g. https://output.jsbin.com/kosisaj/ touch-action: pan-y seems to behave as expected.
Comment 1 Radar WebKit Bug Importer 2021-11-07 08:53:19 PST
<rdar://problem/85125463>
Comment 2 pfg.webkit 2022-04-07 15:40:33 PDT
This seems to have regressed in iOS 15 and was not caught by the tests: https://bugs.webkit.org/show_bug.cgi?id=202053