target treated as passive for listeners on `touchstart, touchmove, touchend` |
|||
Issue description
UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2879.0 Safari/537.36
Example URL:
Steps to reproduce the problem:
1. add event listener for 'touchstart, touchmove' or 'touchend'
2. prevent default behavior on callback
3. trigger the event
document.addEventListener('touchstart', function(event) {
event.preventDefault();
});
document.dispatchEvent(new CustomEvent('touchstart', {
bubbles: true,
cancelable: true
}));
What is the expected behavior?
event listener is not passive, so event default can be prevented.
What went wrong?
event listener is defaulted to passive: true, so i get the error: Unable to preventDefault inside passive event listener due to target being treated as passive.
Does it occur on multiple sites: Yes
Is it a problem with a plugin? No
Did this work before? Yes chrome 53.0.2785.116 (Official Build) (64-bit)
Does this work in other browsers? Yes
Chrome version: 55.0.2879.0 Channel: canary
OS Version: OS X 10.11.6
Flash Version: Shockwave Flash 23.0 r0
,
Oct 4 2016
,
Oct 4 2016
touch events that are registered on the document are treated as passive. This is an user agent intervention that we are pushing to release in beta and stable. More details are going to be published on the dev blog eventually when we goto ship it. You should be using either of these: 1) touch-action 2) pointer-events 3) passive: false (if you really need behavior that isn't covered in the above two)
,
Oct 4 2016
Only touchstart and touchmove, right? touchend should be unaffected (important for suppressing click etc.).
,
Oct 4 2016
Yes Rick https://cs.chromium.org/chromium/src/third_party/WebKit/Source/core/events/EventTarget.cpp?rcl=0&l=86 you always are right :-)
,
Oct 4 2016
Correct, touchend is not affected. I need to preventDefault touchstart and touchmove events in order to disable scrolling when it happens outside a certain node in iron-dropdown, see https://github.com/PolymerElements/iron-dropdown/blob/master/iron-dropdown-scroll-manager.html Would love to use the passive: true & benefit from it, but I don't have other solutions for blocking the scrolling. |
|||
►
Sign in to add a comment |
|||
Comment 1 by cbiesin...@chromium.org
, Oct 4 2016