Event Listener Violation
See original GitHub issueOnce integrated the ng5-slider I’m getting a lot of event listener violation messages within Chrome console .
zone.js:1666 [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
The slider is used like this:
<ng5-slider [value]="port.speed" [options]="defaultOptions" (userChangeEnd)="onSpeedChange($event,port)"></ng5-slider>
defaultOptions: Options = {
floor: 0,
ceil: 255,
step: 1,
noSwitching: true
};
Is this expected behavior?
Issue Analytics
- State:
- Created 5 years ago
- Reactions:2
- Comments:12 (5 by maintainers)
Top Results From Across the Web
Consider marking event handler as 'passive' to make the page ...
Handling of 'touchstart' input event was delayed for X ms due to main thread being busy. Consider marking event handler as 'passive' to...
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 >Passive event listeners
Passive event listeners are an emerging web standard, ... shows a warning in the console: [Violation] Added non-passive event listener to a ...
Read more >Easy fix for: Unable to preventDefault inside passive event ...
How to fix this violation · 1. Remove the need for preventDefault() in the event listener · 2. Mark the event listener not...
Read more >Bing maps violation in Chrome (non-passive event listener to ...
I have the following answer from you from the Maps Engineering Team: The spec https://dom.spec.whatwg.org/#in-passive-listener-flag says "When ...
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

Closing as fixed with v1.1.6 release.
@fi3te: Thanks, I finally figured it out. I had my Chrome Developer Tools console filter set to Default all this time. Once I changed it to All Levels, this showed me the warnings about event listener violation.
I researched the topic a little more and I found a relatively easy solution to use passive event listeners, if the browser supports them. This prevents these warnings from showing up and it should also improve scrolling performance on mobile devices.