-
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
Back button from anchor link does not scroll to previous location #8019
Comments
I just tried this on macOS and could reproduce on Chrome (v 69.0.3497.81). Fixes welcome if anyone can investigate further! |
Can confirm this issue on the following browsers on Mac OS 10.12.6
Steps to reproduce
(FWIW replacing the
Environment
Issue titleI'd suggest that Back button from anchor link does not scroll to previous location is a more descriptive issue title. |
AFAICT this is because hash link scrolling is handled by |
Can confirm the issue is still present on v1 documentation But appears fixed in current (v2) documentation on all browsers below Recreation: Click the anchor links and hit back. Windows 10 Version 10.0.17134 Build 17134
|
The original bug is no longer reproducible for me, however there's a new one. The back button still does not scroll to the correct location. It just scrolls to the top of the page. On https://www.gatsbyjs.org/docs/recipes/ scroll down until the Reproduced on: As before, the scrolling works correctly in IE11. |
I believe that behavior is expected with anchor links. There is no logic to save your the previous scroll location, that is just the browser's default behavior. |
No, that is not true. Try this:
Then open file:///tmp/recipes.html and try to reproduce the problem. |
Old issues will be closed after 30 days of inactivity. This issue has been quiet for 20 days and is being marked as stale. Reply here or add the label "not stale" to keep this issue open! |
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 Thanks again for being part of the Gatsby community! |
If the bot is going to close issues regardless of replies, perhaps it should not suggest that one "reply here ... to keep this issue open" 😥 |
:( sorry about that. There were some earlier issues with gatsbot being overenthusiastic which should be fixed now. |
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! 💪💜 |
This is still a problem. It can be reproduced on https://www.gatsbyjs.org/docs/recipes |
Hey, I'm waiting for a solution as well on this one, still reproducible on our project :) |
Just did the procedure @wodin to reproduce the issue, but I'm unable to reproduce it. OS: Ubuntu 19.10
|
Ah! It's not perfect, but it's vastly improved. Since the To see how it's supposed to work, open the following HTML file in a browser: On the If you follow a similar procedure in the |
Here still happens after updating all plugins. |
Fixed in latest! |
the issue still persists. Tested with Firefox 80.0, Chrome 85.0.4183.83 and Safari 13.1.2 on macOS 10.15.6. Reproduction steps (Firefox only):
Insert this two lines somewhere in
Insert the anchor somewhere below
Back Button will not work:
Won't return to top of page or previous position. Back Button still won't work:
Back Button will work:
|
I have this problem in a project as well |
I don't remember all details. Our site (soon productive) works fine. Rules we use for
Here you can load some manufacturer pages and test fragment links at the sidebars table of content section. https://sx.surface-world.de/hersteller/ Hope this helps. |
I tested your site as well and it is not working as I would expect as a user. Try this:
Behavior: I end up at "Adobe Acrobat 2020" Expected behavior: I would expect to end up at the scroll position I was after scrolling in step 4. I believe this is the default behavior of the browser. You can compare with this page for example: https://www.w3.org/Graphics/Color/Workshop/talks.html |
Yes, that's right and probably not the expected behavior. I'm very busy with the launch of the site and do not have time to address this issue at the moment. I put it at my "post release to do list". If you have time, I would recommend the following steps:
Thanks for indicating this issue. PS: Our site is a Gatsby 2.x site. Could one confirm this issue at Gatsby 3.x? |
Turns out that its a bug in reach/router, there is a comment in the code about it here:
|
So for everybody that is currently experiencing the issue - Replace your internal links with the |
Description
Scrolling to an anchor on the current page works, but clicking the browser's Back button does not scroll back to the previous location.
This is the same as bug #3116, which was closed because of lack of "recent activity", but I can still reproduce it on Firefox and Chromium on Linux and macOS. I have not tried Windows again recently. Opening a new issue as suggested in the last comment.
Steps to reproduce
On https://www.gatsbyjs.org/docs/deploy-gatsby/, scrolled all the way to the top, click on the GitLab Pages link. That scrolls down the page to the right section. Now click the browser's Back button.
Expected result
The browser should scroll back to the top of the page.
Actual result
Instead, the scroll position is not altered.
Demonstration
Environment
This is happening on gatsbyjs.org. I am not using Gatsby myself.
The text was updated successfully, but these errors were encountered: