question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

"Added non-passive event listener" Chrome violation

See original GitHub issue

When opening photoswipe there are a couple of violations in Chrome:

Added non-passive event listener to a scroll-blocking 'wheel' event. Consider marking event handler as 'passive' to make the page more responsive. See https://www.chromestatus.com/feature/5745543795965952

This repeats for the mousewheel event too

I believe it originates from this line: https://github.com/dimsemenov/PhotoSwipe/blob/703c415b1b97e8983fff217644888062f07d308b/src/js/framework-bridge.js#L15

I don’t think this is a duplicate issue but it may be related to https://github.com/dimsemenov/PhotoSwipe/issues/1217

As it doesn’t call preventDefault it seems worth it to add this in, thoughts? It’d just be changing it to:

if(type[i]) {
  target[methodName]( type[i], listener, ['mousewheel', 'wheel'].indexOf(type[i]) === -1 ? false :
 {passive: true});
}

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:3
  • Comments:6

github_iconTop GitHub Comments

2reactions
andreszscommented, Feb 23, 2020

This problem persists with 4.1.3 and Chrome 80.0.3987.116.

To prevent this warning, I replaced "wheel mousewheel DOMMouseScroll" with just "DOMMouseScroll". There is no mouse wheel zoom now, but there is a zoom button in the toolbar. And this is being used in a Cordova app, so there is no mouse wheel available anyway.

Enabling/disabling the mousewheel should be configurable from the photoswipe Options, specially considering that 80% of web traffic (and growing) comes from mobile devices, where there’s no mousewheel.

0reactions
mhluskacommented, Jan 29, 2020

I’m also seeing these with 4.1.3 on Chrome 79.0.3945.130

Read more comments on GitHub >

github_iconTop Results From Across the Web

Warning: Added non-passive event listener to a scroll ...
[Violation] Added non-passive event listener to a scroll-blocking 'mousewheel' event. Consider marking event handler as 'passive' to make the ...
Read more >
Bing maps violation in Chrome (non-passive event listener to ...
Consider marking event handler as 'passive' to make the page more responsive. It makes any website having any map refresh slower and slower....
Read more >
[Violation] Added non-passive event listener to a ... - GitHub
The warning is saying the passive event listeners on the page should be passed the {passive: true} option to improve scroll performance. document....
Read more >
Non-passive event listener warning in Chrome console - v6
When I add a CodeMirror instance to the page, I get this warning pair in Chrome's console [Violation] Added non-passive event listener to...
Read more >
Passive event listeners - Medium
chrome shows a warning in the console: [Violation] Added non-passive event listener to a scroll-blocking 'mousewheel' event. Consider marking ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found