use-gesture
use-gesture copied to clipboard
100ms delay between pointermove events in Android webviews?
Describe the bug I noticed that gestures in Android webviews felt laggy, so after some debugging, I found the root cause: pointermove events have a ~100ms delay between them whereas it should be a ~17ms delay. This isn't directly caused by @use-gesture, but it probably affects a lot of @use-gesture users, so just bringing attention to the issue.
In Android Chrome, when starting a drag gesture, the timeline looks something like:
0ms: pointerdown
3ms: pointermove
10ms: pointermove
27ms: pointermove
44ms: pointermove
In Android webviews, it's something like:
0ms: pointerdown
3ms: pointermove
100ms: pointermove
117ms: pointermove
134ms: pointermove
In each screenshot, I hovered over the first pointermove, then each subsequent pointermove are yellow blocks.
Here's a Codesandbox demo to test the delay: https://codesandbox.io/p/sandbox/clever-shape-8ppngt?file=%2Findex.html%3A1%2C1-17%2C10. You can send the link to yourself via Messenger, which opens it in a webview. I'm getting up to 110ms delay within the Messenger webview (avg around 50ms), and consistently 16-17ms within a browser.
Is this an issue the team is aware of? Is there a possible fix using JS/CSS or do we need to hope the Android folks fix it?
Information:
- Use Gesture version: v10.3.1
- Device: Pixel 8
- OS: Android 14
- Browser: Android webview
Checklist:
- [x] I've read the documentation.
- [x] If this is an issue with drag, I've tried setting
touch-action: none
to the draggable element.
Chromium team is triaging this: https://issues.chromium.org/issues/333624618