Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Touch: Use touch-action and passive event listeners if supported #309
This PR aims at using native
Iiuc, with touch-action and passive event listener support we can use the code originally meant for
With touch-action and passive event listeners supported, the touch event listener can attach to
I haven't checked any corner cases at this point. Just want to make sure I got in principle the expected behaviour and whether we are o.k. with different behaviours across browsers.
I looked some more into the relation between
I made a little example: http://bethge.github.io/touch-action/wall-scroll.html with passive event listeners:
Iiuc, Chrome always fires
You're saying that trying to scroll an element that's already at it's scroll extent will not fire
That is correct. Think of it this way, there are two separate stages: generating a gesture event and that gesture event having an action.
Yes this is correct and it is indeed inconsistent. It boils down to a limitation we have in chromium that effectively means that
A TouchEvent is cancelable in chromium unless:
So you can't infer too much about the exact scenario your in from the
If I understand your issue correctly, you're just trying to decide when to fire the
Computing whether a gesture is allowed by touch-action is non-trivial. To handle all cases (where a developer may have arbitrary complex style rules) you need to implement the touch-action processing model in the spec where you walk up the DOM, getting the computed style and intersecting all the touch-action values. Perhaps something simpler would be good enough though?
Also note that while Safari now supports passive touch listeners and the
As discussed in today's PEP meeting, we'll not further pursue using passive event listeners in combination with touch-action, if the browser supports it.
Chrome is getting ever closer to supporting pointer events natively, and no other browser supports or in the near future plans to support passive event listeners as well as touch-action.