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

Unable to preventDefault inside passive event listener invocation. #223

Closed
zigi05 opened this issue Sep 11, 2019 · 2 comments
Closed

Unable to preventDefault inside passive event listener invocation. #223

zigi05 opened this issue Sep 11, 2019 · 2 comments

Comments

@zigi05
Copy link

zigi05 commented Sep 11, 2019

After a recent Chrome update, the following error began occurring on mobile swipe:

Unable to preventDefault inside passive event listener invocation.
touchmoveHandler @ baguetteBox.js:107

@zalevsk1y
Copy link

zalevsk1y commented Sep 17, 2019

Google changed the default behavior of touch listeners, now they are passive. The same thing in iOS/Safari since version 11.3. And as Google explains:

Registering the event listeners as passive tells the browser that the listeners will not call preventDefault() and the browser can safely perform scrolling and zooming without blocking on the listeners.
So you cannot call preventDefault inside passive event listener.

Solutions:

  • Set css property touch-action:none to body. Not supported by iOS/Safari.
  • Set passive property to false.
    var options = supports.passiveEvents ? { passive: false } : null;

@feimosi
Copy link
Owner

feimosi commented Mar 31, 2020

Fixed in v1.11.1

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

3 participants