"Added non-passive event listener" Chrome violation
See original GitHub issueWhen 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:
- Created 6 years ago
- Reactions:3
- Comments:6
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
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.
I’m also seeing these with 4.1.3 on Chrome 79.0.3945.130