Hi Rick,I'm having a very frustrating time with the new touch events behavior on 36.
In particular, touch-action setting touchmove.cancelable seems to not honor the initial direction of scrolling, but will toggle when hitting a scrolling region's boundaries or after a movement has been made in the other direction.
You can see this on http://www.rbyers.net/touch-action.html.On the "pan-x" box, drag right, then up and down.I would assume that up and down would always be throttled to 200ms and be cancelable, and the current behavior is very confusing.
I can see how the current behavior allows for things like customizable over scroll, but is I'd quite a departure from the PointerEvents touch-action.
In my use case, I have a slide-out panel that has a long list of selectable options. It needs to scroll in the y axis, but slide to close in the x axis. However, it is bad UX to allow both operations to happen at once. In the PointerEvents version of touch action, it was guaranteed that only one behavior, slide or scroll, would occur.
It seems like the only way to get the behavior I need would be to make the touchmove handlers more stateful, and ignore touchmove after a single throttled event.
My worry is that this will be super confusing for other devs, because it differs so much from the PointerEvents behavior, but shares the same name. Perhaps some evangelism would help in this regard.
I can see how the current behavior allows for things like customizable over scroll, but is I'd quite a departure from the PointerEvents touch-action.
In my use case, I have a slide-out panel that has a long list of selectable options. It needs to scroll in the y axis, but slide to close in the x axis. However, it is bad UX to allow both operations to happen at once. In the PointerEvents version of touch action, it was guaranteed that only one behavior, slide or scroll, would occur.
It seems like the only way to get the behavior I need would be to make the touchmove handlers more stateful, and ignore touchmove after a single throttled event.
My worry is that this will be super confusing for other devs, because it differs so much from the PointerEvents behavior, but shares the same name. Perhaps some evangelism would help in this regard.
I didn't initially like this idea because it introduces a coupling between things that are architecturally separate (and to me makes our touch event model more complex/confusing), but if it makes developers lives easier without any loss of real power then maybe it's worth it? Tim/Jared WDYT? Off the top of my head I don't think this would be hard to implement - just more coupling between the TouchActionGestureFilter and the TouchEventQueue/InputRouter.
Or perhaps this is so common that we should introduce a coupling between touch-action and the touch event model for this. I think we could have touch-action: pan-y cause the touch event handling code to enter a special mode where touchcancel is sent when movement starts vertically.
Also, should it be possible for a second touch to cancel an in-progress scroll? It isn't at the moment: https://jsbin.com/xoteq/1/edit?html,js,output
Ignored attempt to cancel a touchmove event with cancelable=false, for example because scrolling is in progress and cannot be interrupted.
This would reintroduce some limited use of touchcancel on scroll (something we eliminated in M35 as confusing / different from other browsers). If we're going to reintroduce this, then the question is when exactly would it happen.In particular, if pan-x causes a touchcancel to be sent on horizontal scrolling, and pan-y causes a touchcancel to be sent on vertical scrolling, then what would you expect to happen for "pan-x pan-y" elements?
On Mon, Aug 18, 2014 at 8:49 AM, Jake Archibald <jakear...@chromium.org> wrote:Also, should it be possible for a second touch to cancel an in-progress scroll? It isn't at the moment: https://jsbin.com/xoteq/1/edit?html,js,outputFor touchmove events (as done by your code) - no. during active scrolling cancelling a touchmove can NEVER stall the scroll (because those events are marked cancelable=false for performance reasons). The fact that you've added a 2nd finger doesn't change this (eg. we don't want pinch updates to be janky either). In fact your code will generate the following warning in the console that I added to try to help explain this:Ignored attempt to cancel a touchmove event with cancelable=false, for example because scrolling is in progress and cannot be interrupted.BUT the question is more interesting if you tried to do this on touchstart events. We debated this a bit here (see the comments on the ScrollUpdate and PinchBegin lines) and weren't sure of the ideal behavior. Perhaps cancelling the touchstart for a 2nd finger while a scroll is in progress should stop the scroll (in addition to preventing the pinch). What are you trying to achieve?
Is there a custom pinch/rotate gesture template out there that works seamlessly with native scrolling (on any platform/browser combination)? If there's precedent and/or some compelling real world scenarios here that are otherwise impossible, then we should absolutely support it.
My worry going forward is that, as we poke and prod the current touch dispatch model, we'll end up with an indecipherable web of state-coupled corner cases, nuances and gotchas. If these changes move us toward an ideal model, for some consistent and well-defined ideal, that's great.
Do we have data on how touch-action affects IE 11's dispatch of touch events? Or even what their current touch dispatch model is (now that they're shipping a form of touch events with 8.1)?
On Mon, Aug 18, 2014 at 9:10 AM, Rick Byers <rby...@chromium.org> wrote:
On Mon, Aug 18, 2014 at 11:48 AM, Jake Archibald <jakear...@chromium.org> wrote:
On Mon, Aug 18, 2014 at 4:08 PM, Rick Byers <rby...@chromium.org> wrote:
This would reintroduce some limited use of touchcancel on scroll (something we eliminated in M35 as confusing / different from other browsers). If we're going to reintroduce this, then the question is when exactly would it happen.In particular, if pan-x causes a touchcancel to be sent on horizontal scrolling, and pan-y causes a touchcancel to be sent on vertical scrolling, then what would you expect to happen for "pan-x pan-y" elements?
pan-x pan-y feels like an opt-out of touchmove events. You'd get a touchcancel after every touchstart.
On Mon, Aug 18, 2014 at 9:10 AM, Rick Byers <rby...@chromium.org> wrote:
On Mon, Aug 18, 2014 at 11:48 AM, Jake Archibald <jakear...@chromium.org> wrote:pan-x pan-y feels like an opt-out of touchmove events. You'd get a touchcancel after every touchstart.If we did this, then I think we'd absolutely want to make the 2nd-finger touchstart synchronous as we're discussing above. Otherwise there's no way to disable pinch-zoom in some region without disabling native scrolling. Doing both seems reasonable to me though.What then about 'touch-action: manipulation'? Today that's the same as 'pan-x pan-y' except it adds pinch-zoom.
Note that it we go this route of coupling touch-action with the touch event dispatch model somehow
, then we should really try to get this into some spec somewhere. I argued that the touch-action portion of the PE spec fully defined our behavior because it was orthogonal (after a minor edit) to the touch dispatch model. I think this is fine (probably even desirable) - just more work.
On Mon, Aug 18, 2014 at 6:26 PM, Rick Byers <rby...@chromium.org> wrote:On Mon, Aug 18, 2014 at 9:10 AM, Rick Byers <rby...@chromium.org> wrote:
On Mon, Aug 18, 2014 at 11:48 AM, Jake Archibald <jakear...@chromium.org> wrote:pan-x pan-y feels like an opt-out of touchmove events. You'd get a touchcancel after every touchstart.If we did this, then I think we'd absolutely want to make the 2nd-finger touchstart synchronous as we're discussing above. Otherwise there's no way to disable pinch-zoom in some region without disabling native scrolling. Doing both seems reasonable to me though.What then about 'touch-action: manipulation'? Today that's the same as 'pan-x pan-y' except it adds pinch-zoom.Hmm, I guess with 'pan-x pan-y' you get touchmoves when there's > 1 touch point, but not if there's 'manipulation'. I'm kinda picking ideas out of the air here so probably wrong.
Note that it we go this route of coupling touch-action with the touch event dispatch model somehowWe're already doing that right? If you've got 'pan-y' and you touch-swipe horizontally we fire touchmove more frequently than we would without 'pan-y'.
, then we should really try to get this into some spec somewhere. I argued that the touch-action portion of the PE spec fully defined our behavior because it was orthogonal (after a minor edit) to the touch dispatch model. I think this is fine (probably even desirable) - just more work.It'd be brilliant to bring the touch events spec up to the quality of pointer events in terms of details. Such as the ordering of equivalent mouse events, when touchcancel is fired, how frequently touchmove is fired, how it interacts with touch-action etc etc. As you say, just more work.
I wonder if there's a common solution that works with "scroll" too, a way to opt-in to sync events without disrupting UA behaviour at the cost of performance.
I agree with Matt that there's not much use in throttled touchmove events that I'm aware of. But also I don't have any use cases for cancelling a touchmove that isn't the first of a particular touch.