bgrins / spectrum

The No Hassle JavaScript Colorpicker
https://bgrins.github.io/spectrum/
MIT License
2.32k stars 588 forks source link

Chrome: non-passive event listener to scroll-blocking 'touchstart' event #500

Open alexdiliberto opened 7 years ago

alexdiliberto commented 7 years ago

Seeing a Chrome Violation in console output from Chrome 61 related to event listener performance. The code that initiates the chrome violation is here:

https://github.com/bgrins/spectrum/blob/1.8.0/spectrum.js#L307

[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
  ... // Start stack trace
  | initialize | @ | spectrum.js:307
  | spectrum | @ | spectrum.js:952
  ... // Continue stack trace
swampthang commented 5 years ago

I'm seeing this as well, alexdiliberto. Did you ever find a solution?

alexdiliberto commented 4 years ago

I believe we'll need to add the passive option when setting any event listeners which don't call preventDefault. This library currently uses jQuery and jQuery isn't planning to support passive event listeners until their 4.0 release