alvarotrigo / pagePiling.js

pagePiling plugin by Alvaro Trigo. Create a scrolling pile of sections. http://alvarotrigo.com/pagePiling/
4.1k stars 654 forks source link

lighthouse page speed performance report "passive listeners" #215

Closed nfsarmento closed 3 years ago

nfsarmento commented 3 years ago

Thank you for making this available and free to everyone.

When running Google PageSpeed insights have the warning below. It is possible to fix it?

"Does not use passive listeners to improve scrolling performance Consider marking your touch and wheel event listeners as passive to improve your page's scroll performance."

alvarotrigo commented 3 years ago

Yeah there's nothing to worry about. That's just a warning that's why the error uses the word "consider" :)

As can be read on the docs pointed out by the "Learn more" link on the error, passive event listeners are used to indicate the browser that our event listener won't be preventing the scroll:

Passive event listeners solve this problem by letting you indicate that an event listener will never prevent scrolling.

However pagePiling.js works by preventing the default scroll behaviour and therefore it needs to prevent both touch and scroll events.