[pointerevents] `touch-action: none` behavior is intuitive in Firefox, confusing in Chrome. The spec should be clearer. (#387)

trusktr has just created a new issue for https://github.com/w3c/pointerevents:

== `touch-action: none` behavior is intuitive in Firefox, confusing in Chrome. The spec should be clearer. ==
(Continuing from #276)

I believe `touch-action:none` should prevent _all_ default interaction (as if `preventDefault()` was called for all cases), and the developer will handle all interaction inside the container, regardless if from fingers, a mouse, or anything else.

Firefox appears to do what I just described, but Chrome does not. This led me to believe there was some sort of bug in Chrome, and even Chrome engineers did not know what was happening, which shows how confusing the problem is:

https://bugs.chromium.org/p/chromium/issues/detail?id=1166044

I think it would be very intuitive for `touch-action:none` to prevent _all_ native interactions for all pointers.

A couple key points:

1)  The spec says that `touch-action:none` applies to
    > interactions (which are not limited to touch, despite the property's name).
2) One can present the case that selecting text involves the same motion as a panning gesture (just that it will select text instead of panning): pointer down, pointer move, pointer up.

Based on the previous two points, and the fact that the purpose of the Pointer Events API is to unify handling of pointers regardless if they are fingers, pens, mouse cursors, trackball cursors, or anything else, it would make sense for the `touch-action` property (especially the behavior of `touch-action:none`) to apply to all gestures (panning and text selection are the same gesture) for all forms of pointers. Essentially the developer should decide exactly what pointer interaction will do, by implementing handling using Pointer Events.


The pattern of Pointer Event handling code seen in the bug's example works intuitively as expected in Firefox, which is great: no unexpected surprises.

The behavior in Chrome is confusing and not intuitive, and makes development using Pointer Events difficult and error prone; it took a while for anyone, including the Chrome team, to realize what was happening in the above Chromium bug report.  The occurrence of the `pointercancel` events was totally unexpected.

To make it work in Chrome, the pattern has to be refactored.

Please view or discuss this issue at https://github.com/w3c/pointerevents/issues/387 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Friday, 18 June 2021 04:05:51 UTC