Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
kajman-cz opened this issue Nov 11, 2023 · 1 comment

Comments

@kajman-cz
Copy link

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
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants