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

Gatsby websites auto scroll back to the top #6392

Closed
learnitmyway opened this issue Jul 11, 2018 · 11 comments
Closed

Gatsby websites auto scroll back to the top #6392

learnitmyway opened this issue Jul 11, 2018 · 11 comments

Comments

@learnitmyway
Copy link

@learnitmyway learnitmyway commented Jul 11, 2018

Description

When a Gatsby website loads, the user can happily start scrolling. However, after some time has elapsed the page scrolls back up to the top.

Steps to reproduce

This can be reproduced at https://www.gatsbyjs.org/ or https://reactjs.org/ by going to the website with a throttled network connection and scrolling down before render() is called.

Expected result

It should not scroll to the top

Actual result

It scrolls to the top. This will not happen if JS is disabled.

Environment

File contents (if changed)

gatsby-config.js: N/A
package.json: N/A
gatsby-node.js: N/A
gatsby-browser.js: N/A
gatsby-ssr.js: N/A

@m-allanson m-allanson added this to To Do - v2 in Gatsby v2 Release via automation Jul 12, 2018
@m-allanson m-allanson moved this from To Do - v2 to non-blocking but would be great to have in Gatsby v2 Release Jul 12, 2018
@m-allanson
Copy link
Contributor

@m-allanson m-allanson commented Jul 12, 2018

Thanks for the report @developerdavo. This is mentioned over in #5675. For anyone interested in picking this up, check the discussion in 5675 for pointers on where to start investigating.

Loading

@humphreybc
Copy link
Contributor

@humphreybc humphreybc commented Sep 3, 2018

Any update on this? I don't believe it's resolved in v2.

Loading

@KyleAMathews
Copy link
Contributor

@KyleAMathews KyleAMathews commented Sep 3, 2018

@humphreybc no not yet unfortunately. The fix is I believe to check in https://github.com/gatsbyjs/gatsby/blob/master/packages/gatsby-react-router-scroll/README.md if scroll has already happened and to not then scroll to the top which is it's default. Or perhaps easier to just not scroll at all on the initial load of the website.

Would you like to work on a PR? This would be really nice to fix!

Loading

@humphreybc
Copy link
Contributor

@humphreybc humphreybc commented Sep 5, 2018

@KyleAMathews I would love to but I'm a bit short on time right now unfortunately 🙁

Loading

@KyleAMathews
Copy link
Contributor

@KyleAMathews KyleAMathews commented Sep 5, 2018

No worries :-) hopefully someone will pick this up soon

Loading

@stefanprobst
Copy link
Contributor

@stefanprobst stefanprobst commented Sep 14, 2018

I think this would be fixed by returning false in shouldUpdateScroll. The problem is: what should happen on page reload (when we want to scroll to the last saved position)?

Loading

@mpartipilo
Copy link
Contributor

@mpartipilo mpartipilo commented Nov 23, 2018

This is probably the same thing that is happening for me whenever I am actively scrolling the page and a part of the DOM changes with a timer. I'll try to post a simple repro.

Loading

@gatsbot gatsbot bot added the stale? label Feb 2, 2019
@gatsbot
Copy link

@gatsbot gatsbot bot commented Feb 2, 2019

Hiya!

This issue has gone quiet. Spooky quiet. 👻

We get a lot of issues, so we currently close issues after 30 days of inactivity. It’s been at least 20 days since the last update here.

If we missed this issue or if you want to keep it open, please reply here. You can also add the label "not stale" to keep this issue open!

Thanks for being a part of the Gatsby community! 💪💜

Loading

@abumalick
Copy link
Contributor

@abumalick abumalick commented Feb 2, 2019

I really think that this one is important

Loading

@KyleAMathews
Copy link
Contributor

@KyleAMathews KyleAMathews commented Feb 3, 2019

@wardpeet actually fixed this a couple of weeks ago!

#11224

Loading

@abumalick
Copy link
Contributor

@abumalick abumalick commented Feb 3, 2019

Loading

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Gatsby v2 Release
  
non-blocking but would be great to have
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
7 participants