react-infinite-scroll-component icon indicating copy to clipboard operation
react-infinite-scroll-component copied to clipboard

[Violation]: Added non-passive event listener to a scroll-blocking event.

Open Math3v opened this issue 4 years ago • 2 comments

Google Chrome generates a Violation warning in the console when the component is instantiated.

Google Chrome: Version 80.0.3987.149 (Official Build) (64-bit) react-infinite-scroll-component: 5.0.4

I think the addEventListeners need to pass passive: true option as described in: https://github.com/WICG/EventListenerOptions/blob/gh-pages/explainer.md#solution-the-passive-option

There might be some work needed to detect the availability of this option: https://github.com/WICG/EventListenerOptions/blob/gh-pages/explainer.md#feature-detection

General Information about the passive event listeners: https://www.chromestatus.com/feature/5745543795965952

The console shows a couple of warnings in our case:

trycatch.ts:91 [Violation] 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
trycatch.ts:91 [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
trycatch.ts:91 [Violation] Added non-passive event listener to a scroll-blocking 'touchmove' event. Consider marking event handler as 'passive' to make the page more responsive. See https://www.chromestatus.com/feature/5745543795965952

Math3v avatar Apr 06 '20 12:04 Math3v

i have the same problem

pucitos avatar Jun 24 '20 12:06 pucitos

Ditto, warning seems to cause the scroll to reset and return to the top of the page image

stewartsanderstbm avatar Sep 12 '22 02:09 stewartsanderstbm