Scroll position is not preserved when using back and forward buttons
Nobody has claimed this yet.
- Dominant language
- Vue
- Stars
- 3.2k
- Forks
- 5k
- Avg merge
- 14d 17h
- Merged PRs (30d)
- 1
Description
I expect to land on the same scroll position as I was before on a page A, when I use a back button on page B.
I end up on the top of the page A or even at a different position, instead of on the scroll position I was before.
Reproduction
- visit https://vuejs.org/guide/introduction.html
- scroll to the bottom of the page, I can now see a heading "Pick Your Learning Path"
- click on "Quick Start" in the left navigation menu, I am now on page https://vuejs.org/guide/quick-start.html
- scroll to the bottom of the page, I can now see a heading "Next Steps"
- hit Back button in the browser
- I can see the heading "Pick Your Learning Path" on page "Introduction"
- hit Forward button in the browser
- I am on page "Quick Start". I can no longer see the heading "Next Steps". I can see "Using Vue from CDN" at the top of my viewport.
- quickly hit back, forward, back, forward in the browser
- I am on page "Quick Start". I can no longer see any of the headings mentioned above, because I am on the top of the page suddenly.
Expected behavior
Ideally the scroll position would be preserved at the exact same position, as it is done on plain HTML by browsers.
The issue is not present when I disable JavaScript in DevTools.
Environment
Browser: Firefox 112
OS: Pop_OS (Ubuntu) 22.04
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the back/forward navigation sequence on the Vue documentation pages in Firefox with JavaScript enabled, then compare it with JavaScript disabled. Trace the documentation site's client-side navigation and scroll restoration behavior; done means returning to Introduction and Quick Start restores the prior scroll positions reliably during repeated back and forward navigation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend, web-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100