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 Warning #333

Open
knoxcard opened this issue Oct 21, 2017 · 11 comments
Open

Chrome Warning #333

knoxcard opened this issue Oct 21, 2017 · 11 comments

Comments

@knoxcard
Copy link

knoxcard commented Oct 21, 2017

Enable verbose output in the Chrome Inspector...

jquery.min.js:3 [Violation] Added non-passive event listener to a scroll-blocking 'touchstart' event. Consider marking event handler as 'passive' to make the page more responsive. See https://www.chromestatus.com/feature/5745543795965952

Chrome Version: Version 62.0.3202.62 (Official Build) (64-bit)

@dpmango
Copy link

dpmango commented Nov 9, 2017

same issue, And seems to be normal page scroll is blocked with touchswipe enabled

@mattbryson
Copy link
Owner

I'm working on a new branch that totally re works the event model, and will hopefully sort these sort of issues. Will update the ticket as I go...

@voxelmator
Copy link

Exactly the same issue. Tap and DoubleTap are not working anymore.

"jquery-3.2.1.min.js:3 [Violation] Added non-passive event listener to a scroll-blocking 'touchmove' event. Consider marking event handler as 'passive' to make the page more responsive. See https://www.chromestatus.com/feature/5745543795965952"

@knoxcard
Copy link
Author

knoxcard commented Jan 9, 2018

Any update on this? We need another version release push bad! Thanks for all the great work put into this.

**When I get some free time I'd like to contribute to improving the codebase.

@mgerasimchuk
Copy link

Any update on this? +1

@Gonzo2O28
Copy link

Anyone?

@knoxcard
Copy link
Author

knoxcard commented Sep 14, 2018

to suppress this warning you can...
addEventListener('touchstart', this.callPassedFuntion, { passive: false })

https://stackoverflow.com/questions/39152877/consider-marking-event-handler-as-passive-to-make-the-page-more-responsive

@knoxcard
Copy link
Author

knoxcard commented Sep 14, 2018

Even better?...

     $(document).ready(function() {
          document.addEventListener('touchstart', onTouchStart, {passive: true})
          .../ the rest of your code..
     })

https://developers.google.com/web/tools/lighthouse/audits/passive-event-listeners

@knoxcard
Copy link
Author

#345

@mattbryson
Copy link
Owner

@knoxcard There are a few things to consider here.

TouchSwipe does not use passive listeners, it does need to call preventDefault() during the touch move to stop the page scrolling inadvertently.

If you a swiping a carousel left / right, this prevents the page from moving slightly up and down as you do so.

I cant see anyway with chrome to flag the listener as active, or {passive:false} - it will always show that warning.

Also JQ doesn't support the new event options, so even if we did set it on all the bind / on calls it wouldn't make any difference.

If you did set it, your right, it would suppress the warning when the event is bound, but it would then error when the handler tries to call e.preventDefault

Ill try to get some time this week to finish off re working the event model that I started months ago :)

@mattbryson mattbryson added this to the New Event Model milestone Sep 17, 2018
@knoxcard
Copy link
Author

Sounds good, thanks @mattbryson

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

No branches or pull requests

6 participants