-
Notifications
You must be signed in to change notification settings - Fork 1
Description
Describe the bug
If I scroll a page, suddenly stop the mouse, and then release the mouse button while the mouse is nonmoving, the page sometimes starts moving.
Steps To Reproduce
Steps to reproduce the behavior:
- Go to https://patorjk.com/misc/scrollingtext/timewaster.php
- In scrollbar or smartphone mode, drag the page with the left or right button.
- Stop the mouse abruptly.
- Release the button.
Expected behavior
The page does not move.
Device info:
- operating system: Fedora 42
- Browser and version: Firefox 142.0.1 (64-bit)
- addon version: 9.2
Additional info
I think the problem is when you initiate momentum scroll when I release my mouse button, you take the velocity computed from the distance between the last 2-ish mouse cursor updates divided by the time difference. This breaks when the mouse doesn't move at all before releasing it, but it was last moving at high speed.
If the mouse is released after the last mouse movement update, you should instead use the distance between the last mouse movement and the position of the release to compute momentum scrolling.
Question: How long between a position update and a button release, before we treat it as nonmoving?
- At all?
- More than 10ms? 100ms?
- More than 2x the polling rate?
- But you don't know the polling rate, and just because the user moves the mouse every 500ms you shouldn't treat a mouse release as a momentum scroll because it happens 400ms after moving the mouse.