metafizzy / flickity

:leaves: Touch, responsive, flickable carousels
https://flickity.metafizzy.co
7.5k stars 604 forks source link

PageSpeed Insights recommends using passive flag for touch event listeners #1289

Open kajman-cz opened 8 months ago

kajman-cz commented 8 months ago

In diagnostic section in PageSpeed for page with Flickity 2.3.0 https://pagespeed.web.dev/analysis/http-kod-djpw-cz-lfld-/640hzu4fjs?form_factor=mobile is 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. Learn more about adopting passive event listeners._

I don't know if it is enough to replace in the library this row elem[ bindMethod ]( startEvent, this ); by elem[ bindMethod ]( startEvent, this, /^(touch|wheel)/.test(startEvent) ? { passive : true } : false );

Passive support should also be detected for old browsers.

maddhacker24 commented 5 months ago

Any update on this? Google Page Speed Insights/Lighthouse is flagging Flickity on my website as well.