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
[useScrollTrigger] Make it scroll event handler passive #32437
Comments
Oh and by the way this is the article about passive event handlers. |
useScrollTrigger
scroll event handler passive
I don't see any reason for not having the event marked as passive. This issue is good to take. |
I'd be happy to take this one. |
Could this create layout issues? It makes it possible for the scroll and the displayed elements to be out of sync. If React setstate triggers the paint in an asynchronous fashion, then we don't have this timing guaranteed anyway. Why not move forward, the UX aspect is likely marginal and the DX win with less noise sound good. |
Duplicates
Latest version
Summary 💡
Google Page Speed Insights warns about scroll event listeners not being passive.
So maybe the scroll event listener in
useScrollTrigger
should be passive? As long as there is no reason for it not to be?I can make a PR but I do not want to do it if there is actually a reason for the event listener not to be passive. :)
Examples 🌈
https://github.com/mui/material-ui/blob/master/packages/mui-material/src/useScrollTrigger/useScrollTrigger.js#L34-L37
Motivation 🔦
Just want to have one less thing to worry about in page speed insights 😁
The text was updated successfully, but these errors were encountered: