yowainwright/stickybits

Consider using a passive scroll listener, if possible

philwolstenholme opened this issue · 2 comments

Is your feature request related to a problem? Please describe.

Lighthouse currently flags sites using Stickybits as 'Does not use passive listeners to improve scrolling performance'

Describe the solution you'd like

Would a passive scroll listener be appropriate for Stickybits? Could the listener be made passive? It looks like this happened at one point in Stickybits (https://github.com/dollarshaveclub/stickybits/pull/46/files) but it seems to have been lost in code refactoring?

Additional context

Screenshot 2020-03-30 at 10 27 01

https://web.dev/uses-passive-event-listeners/

Hey, thanks for filing an issue with Stickybits' first issue

I've just re-read https://developers.google.com/web/tools/lighthouse/audits/passive-event-listeners#recommendations and seen that scroll does not need to be made passive, so I'm closing this issue - sorry for the noise!

In general, add the passive flag to every wheel, mousewheel, touchstart, and touchmove event listener that does not call preventDefault().