shipshapecode / tether

A positioning engine to make overlays, tooltips and dropdowns better
https://tetherjs.dev/docs/welcome
MIT License
8.5k stars 749 forks source link

touchmove handler can impact scroll performance #128

Open RByers opened 8 years ago

RByers commented 8 years ago

I work on chromium and was investigating scroll performance on time.com and that led me to the tether.js code that adds a touchmove listener. touchmove (and wheel) listeners can have a substantial impact on scroll performance. I'd like to understand the use cases here so we can help improve the web platform to avoid the performance implications.

Can you help me understand what tether.js's touchmove listener is doing? To me it appears to (along with the scroll and resize listeners) cause the positions of elements to be updated. But shouldn't scroll and resize be enough on their own? I certainly can't think of any scenario where you'd get a touchmove that moves things around without also a scroll (except maybe during pinch-zoom)?

We hope to be adding tooling to Chrome devtools to better help site owners blame specific scripts for scroll performance issues. If, as I suspect, the touchmove listener in tether.js isn't providing any real value, then hopefully you can just remove it. But if it is, then I'd like to better understand the scenario so we can help address it (maybe with passive event listeners?)

crabmusket commented 7 years ago

I certainly can't think of any scenario where you'd get a touchmove that moves things around without also a scroll (except maybe during pinch-zoom)?

You'd think that would be covered by the resize listener.

breezewish commented 7 years ago

Updates? passive event listeners are landed in modern browsers.

RobbieTheWagner commented 4 years ago

@RByers your logic seems sound to me, that scroll should be enough. I would be in favor of removing touchmove I think. We would need to ensure that scroll is sufficient first though.