Investigation
After the user do scrolling gesture (e.g. dragging scroll handler up), browsers will do two things:
- Set
scrollTop to a new value
- Fire
scroll event
In Firefox, it do 1 and 2 asynchronously. There is a slight chance that our "should we scroll to bottom" check is scheduled to be execute between 1 and 2. If the check is being scheduled untimely, the check will think "yes, I need to scroll, I am not at bottom yet and user didn't scroll me, I didn't see any scroll event."
But in fact, if we wait a bit more time (~20ms), we will see the scroll event emitted from Firefox. And the scroll event indicate user-initiated scrolling, which will release the stickiness, until the user scroll to the bottom or hit the scroll to end button.
Implementation
The fix is to wait for additional 34 ms (2 frames in 60 FPS), to see if the scroll event will fire and disable the stickiness.
Investigation
After the user do scrolling gesture (e.g. dragging scroll handler up), browsers will do two things:
scrollTopto a new valuescrolleventIn Firefox, it do 1 and 2 asynchronously. There is a slight chance that our "should we scroll to bottom" check is scheduled to be execute between 1 and 2. If the check is being scheduled untimely, the check will think "yes, I need to scroll, I am not at bottom yet and user didn't scroll me, I didn't see any
scrollevent."But in fact, if we wait a bit more time (~20ms), we will see the
scrollevent emitted from Firefox. And thescrollevent indicate user-initiated scrolling, which will release the stickiness, until the user scroll to the bottom or hit the scroll to end button.Implementation
The fix is to wait for additional 34 ms (2 frames in 60 FPS), to see if the
scrollevent will fire and disable the stickiness.