Re: [pointerevents] touch-action and scrolling directional lock (#303)

> If there isn't a specification defining this behavior, should there be additional behavior to let page authors enable such directional locks? (As an aside, iOS offers an API on UIScrollView has the directionalLockEnabled property that allows for just that.)

That is the touch-action role here. But touch action doesn't specify quite what the user agent does with that. So I wouldn't say that necessary only applies to the scroll. But we can say here is a new value for touch-action (say 'single-direction') that let the browser to do its own action (being scrolling or pull to refresh or anything else) only on the first direction that user moved their finger. That way UA will lock in the scrolling behaviors and UA will have maybe 3 directions in general like (horizontal, vertical, diagonal) or even maybe only the two x and y directions. Feel free to file a new issue for adding such touch-action value if you believe there are use cases for it out there.

At last there is another note regarding the pointercancel event. Even if the particular scroller that got the scroll latching is not scrollable in the starting direction (this particular case only happens when it is root scroller) and user drags the finger on the page, Chrome still sends a pointercancel as if the user starts moving the finger in the other direction Chrome will starts the scrolling of that latched scroller. Here is an [example](https://output.jsbin.com/lovapiy) for that. So if you start scrolling in horizontal direction (even though there is nothing to scroll) but Chrome has already taken over that action and latched to the root scroller. So Chrome sends the pointercancel from the beginning and if user then starts moving the finger in vertical document does get scrolled in the y direction. Does that make sense?


Just another note that regarding pointercancel

If there isn't a specification defining this behavior, should there be additional behavior to let page authors enable such directional locks? (As an aside, iOS offers an API on UIScrollView has the directionalLockEnabled property that allows for just that.)

There isn't much of a heuristic around it. It doesn't have much do to with the touch-action either. We have 3 direction locking essentially. If after touch point moves out of the slop region the direction is mostly vertical from that point on we ignore all the horizontal deltas. The same for horizontal scrolling and diagonal

Even if the page is not scrollable and user drags the finger on the page Chrome sends a pointercancel regardless of the scroller (as you can see in [this page](https://output.jsbin.com/tikegig))



-- 
GitHub Notification of comment by NavidZ
Please view or discuss this issue at https://github.com/w3c/pointerevents/issues/303#issuecomment-526745907 using your GitHub account

Received on Friday, 30 August 2019 20:51:56 UTC