Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chrome warnings about preventDefault of passive targets #6

Closed
jmtoball opened this issue May 10, 2017 · 3 comments
Closed

Chrome warnings about preventDefault of passive targets #6

jmtoball opened this issue May 10, 2017 · 3 comments

Comments

@jmtoball
Copy link

Hello and thank you for this polyfill. It's exactly what we've been looking for. There's just one small issue:
Chrome (probably starting at version 56) seems to not be happy about the preventDefault-calls as it treats the touch-listeners as passive. This does not seem to interfere with the functionality, but for a simple drag-process, ~100 of these warnings are logged to the console:
[Intervention] Unable to preventDefault inside passive event listener due to target being treated as passive. See https://www.chromestatus.com/features/5093566007214080
I fear that this may also be discouraged for mobile browsers and may become unsupported in the future, so I thought I'd give you a heads-up.

@Bernardo-Castilho
Copy link
Owner

Thank you for the feedback. I had seen those messages and they bothered me as well, but it wasn't obvious to me how I could detect the passive listener support. When I saw your message, I searched a bit and found a way to do it (Modernizr/Modernizr#1894).

The latest version adds the listeners as non-passive, and that seems to solve the issue (no messages on the console).

Thanks a lot for pointing this out,

PS: Some articles suggested using CSS to prevent the standard touch behaviors instead of using non-passive event listeners. I tried that approach as well but couldn't make it work properly.

@jmtoball
Copy link
Author

Awesome, much less spam in the console :-)

@Bernardo-Castilho
Copy link
Owner

Glad to know it worked, thanks for the feedback! And thanks for reporting the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants