Skip to content
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

Scroll position locked in Firefox #13

Closed
compulim opened this issue Feb 13, 2019 · 0 comments
Closed

Scroll position locked in Firefox #13

compulim opened this issue Feb 13, 2019 · 0 comments

Comments

@compulim
Copy link
Owner

Investigation

After the user do scrolling gesture (e.g. dragging scroll handler up), browsers will do two things:

  1. Set scrollTop to a new value
  2. 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant