ScrollMagic icon indicating copy to clipboard operation
ScrollMagic copied to clipboard

Warning: non-passive event listener to a scroll-blocking 'mousewheel' event

Open janat08 opened this issue 7 years ago • 6 comments

[Violation] Added non-passive event listener to a scroll-blocking 'mousewheel' event. Consider marking event handler as 'passive' to make the page more responsive.

janat08 avatar Apr 20 '18 14:04 janat08

Any solution for this so far @janat08 ? Running into the same issue with React 16.3. Initializing ScrollMagic in componentDidMount() (which was worked thus far).

tugjg avatar May 14 '18 13:05 tugjg

no

janat08 avatar May 14 '18 14:05 janat08

I was able to fix this using the guide here to check if passive is supported and then add the passive flag to each addEventListener in ScrollMagic.js as shown in their example, i.e.

window.addEventListener("mousewheel", function () {}, passiveSupported ? { passive: true } : false);

melpers avatar Jan 30 '19 17:01 melpers

@melpers This would be such an easy performance fix, could you create a pull request?

fvonellerts avatar Oct 15 '19 08:10 fvonellerts

@melpers Would you be able to post a link to the new SM file you use that incorporates passive event listeners?

jon4896 avatar Mar 25 '21 16:03 jon4896

I can't post a link as the site that was using it was taken down and the repo is private. However, I dug up a copy of it and am attaching it here. YMMV. ScrollMagic_passive_patched.js.zip

melpers avatar Mar 25 '21 17:03 melpers