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

Navigation back with anchors is broken #16508

Closed
aralroca opened this issue Aug 24, 2020 · 6 comments
Closed

Navigation back with anchors is broken #16508

aralroca opened this issue Aug 24, 2020 · 6 comments
Assignees
Milestone

Comments

@aralroca
Copy link
Contributor

Bug report

Describe the bug

When you enter directly on a page with an anchor and then you navigate to another page, everything is fine. But when you press to go back on the previous page, the navigation is broken.

To Reproduce

Steps to reproduce the behavior, please provide code snippets or a repository:

I created a reproducible example:

Code: https://codesandbox.io/s/nextjs-forked-660z5?file=/pages/index.tsx
Executable: https://660z5.sse.codesandbox.io/#example

  1. Go to 'https://660z5.sse.codesandbox.io/#example' (with the #example hash)
  2. Click on 'Navigate to page 2'
  3. Press the browser button to navigate back
  4. See error: The back button is not working well

Expected behavior

Should navigate back.

System information

  • OS: macOS
  • Browser: chrome
  • Version of Next.js: 9.5.2
  • Version of Node.js: 14.8.0
@aralroca aralroca changed the title Navigation with anchors is broken Navigation back with anchors is broken Aug 24, 2020
@Yogendra0Sharma
Copy link

@aralroca Working fine with Windows 10 + Chrome Version 84.0.4147.135 + ABove Link

@ijjk
Copy link
Member

ijjk commented Aug 24, 2020

Hi, the above reproduction doesn't appear to be having any problems, we also have tests covering navigating with an anchor tag and back which are passing.

@Timer Timer added this to the iteration 8 milestone Aug 24, 2020
@littleninja
Copy link

Could it be related to #9833? (Might be worth noting that the linked issue is with macOS/iOS + Safari, the report here is macOS + Chrome.)

@aralroca
Copy link
Contributor Author

A thousand apologies, because I thought I had reproduced it correctly and now I see that with the Codesandbox it doesn't happen to me either. In local it does happen to me, I am trying to reproduce it again from the sandbox. While I close the issue, I'll open it again after creating a reproducible example.

@aralroca
Copy link
Contributor Author

Meanwhile, I share a video here about what is happening to me:

video.mov.zip

Some details:

  • I'm using a custom server
  • I'm using the function getServerStaticProps on the page of the hash
  • I'm using Preact
  • I'm using next-translate with the custom server approach (middleware)

I'll try to do a reproducible example

@balazsorban44
Copy link
Member

This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@vercel vercel locked as resolved and limited conversation to collaborators Jan 29, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants