-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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 behaviour not as expected with gatsby navigate #12997
Comments
Can you provide more complete reproduction? Ideally one that can be cloned and run to see the issue? |
http://gatsby.dev/reproduction for instructions |
The issue is that when clicking the button the scroll position jumps to the top. index.js and gatsby-browser.js are the only files modified. Once you downgrade gatsby-react-router-scroll to version 2.0.6 The scroll behaviour is as expected. Thank you! |
And, I may see the reason for what's happening here. NOT a good thing, if so..
Why is this important? Well, it's a bit too much to fully explain, but I'm providing live preview editing for Gatsby pages before they're (re-)built, when driven by a remote page data service, and this requires reloading the current page at the current url. So, no back button or route change occurs. It's critical that an editor not see their page jump around. That's what I need to preserve, and with thanks, and please. |
For some reason, the note I placed on the 2.0.7 mod isn't getting referenced here, maybe because that's not an issue post, so you can connect to those messages here: #12403 (comment) |
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! 💪💜 |
Right on time, as I'm about to release a complicated product, and it must not have its screen jumping around. I've been leaving it pinned to the version before this bug showed up, and will check if there's been any silent repair. Meanwhile, kindly do not close this issue, thanks. |
(@KyleAMathews, an intermediate message deleted, as a cache apparently fooled tests, and this mod still causes the same trouble. I'll be back...) |
@KyleAMathews Ok, I've fixed this for our purposes, so shipping can happen. First the fix for others interested, and then a comment or two may not go amiss.
That's I think pretty bullet-proof, so here's comment:
Because of these difficulties, it's very clear why @pieh created a passel of tests to accompany the change. That was well done, respectful in the circumstance.
Regards, |
Hey again! It’s been 30 days since anything happened on this issue, so our friendly neighborhood robot (that’s me!) is going to close it. Please keep in mind that I’m only a robot, so if I’ve closed this issue in error, I’m As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out gatsby.dev/contribute for more information about opening PRs, triaging issues, and contributing! Thanks again for being part of the Gatsby community! |
Just to close this off, the solution for a need I posted just above doesn't work for a home page. Thus I simply stopped using Gatsby's mechanism at all; simple to provide one's own. Why this failed appears to show up interesting if not improper scroll memory behavior in the Gatsby system now, after the 'use location.key' modification. I've detailed that in another posting, where there actually was some attention paid, and won't comment further here. See for the info: #12560 (comment) |
I have a page with a list of links to filter data and the following useEffect hook is causing me problems:
The issue is that every time i click on a link, the scroll position jumps to the top. Im expecting the scroll position to remain the same after clicking the link, which i believe should be the normal behaviour.
I was able to solve this issue by adding the following code to gatsby-browser.js
However, since gatsby-react-router-scroll was updated to version 2.0.7, the above code is no longer working for some reason. Im able to downgrade gatsby-react-router-scroll to version 2.0.6 to fix this problem but i'm looking for a real solution. Thank you
The text was updated successfully, but these errors were encountered: