react-infinite-scroll-component
react-infinite-scroll-component copied to clipboard
[Violation]: Added non-passive event listener to a scroll-blocking event.
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 addEventListener
s 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
i have the same problem
Ditto, warning seems to cause the scroll to reset and return to the top of the page