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.

Event Listener Violation

See original GitHub issue

Once 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:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:12 (5 by maintainers)

github_iconTop GitHub Comments

3reactions
piotrdzcommented, Nov 14, 2018

Closing as fixed with v1.1.6 release.

1reaction
piotrdzcommented, Nov 7, 2018

@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.

Read more comments on GitHub >

github_iconTop 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 >

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