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

Hash history router doesn't scroll to top when visiting a new page #3479

Open
kottkrig opened this issue Feb 19, 2025 · 0 comments
Open

Hash history router doesn't scroll to top when visiting a new page #3479

kottkrig opened this issue Feb 19, 2025 · 0 comments

Comments

@kottkrig
Copy link

Which project does this relate to?

Router

Describe the bug

When using hash history via createHashHistory, navigation to new pages doesn't scroll to the top of the page. Instead it seems to keep the scroll position from the original page.

Your Example Website or App

https://stackblitz.com/edit/github-4rybtq-5mekkq2j?file=src%2Froutes%2Findex.tsx,src%2Froutes%2Fabout.tsx,src%2Fmain.tsx

Steps to Reproduce the Bug or Issue

  1. Scroll down
  2. Click on "Go to about"
  3. Confirm that you are in a scrolled state

Expected behavior

As a user, I expect to go to the top of /about when I haven't been there before. Instead I end up scrolled to the middle of the page.

Screenshots or Videos

No response

Platform

  • OS: macOS
  • Browser: Arc
  • Version: Chromium Engine Version 133.0.6943.35

Additional context

The incorrect behaviour is only visible when using "hash history". When using default browser history the navigation behaves as expected.

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