vitepress
                                
                                 vitepress copied to clipboard
                                
                                    vitepress copied to clipboard
                            
                            
                            
                        [Navigate] backward and forward buttons do not work as expected
Describe the bug
The back and forward buttons do not work when I click on the menu to navigate to a different page.
 
Reproduction
https://vitepress.vuejs.org/guide/getting-started.html
Expected behavior
The back and forward buttons work as expected
System Info
System:
    OS: macOS 12.2.1
    CPU: (8) arm64 Apple M1
    Memory: 71.08 MB / 8.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 16.14.0 - /usr/local/bin/node
    Yarn: 1.22.4 - /usr/local/bin/yarn
    npm: 8.3.1 - /usr/local/bin/npm
  Browsers:
    Chrome: 103.0.5060.114
    Chrome Canary: 105.0.5176.0
    Firefox: 101.0.1
    Safari: 15.3
Additional context
No response
Validations
- [X] Follow our Code of Conduct
- [X] Read the docs.
- [X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
The back and forward buttons do not work when I click on the menu to navigate to a different page.
Can you explain a bit more? They appear to be working fine for me:
https://user-images.githubusercontent.com/40380293/178672782-91f9a562-292b-4f3b-96d6-8a385a451ad4.mp4
That's weird, it's not work on my Chrome.
https://user-images.githubusercontent.com/73412177/178732802-0c1a0dad-f38f-4ece-82dd-aa2834b1e319.mov
I am still not able to reproduce this. Its maybe due to some race condition, or maybe something else. Marked this as a bug (needs investigation though). Anyway, your PR doesn't seem like a proper fix. replaceState must be called before pushState otherwise the scroll position won't be preserved. I am closing that for now.
Closing as non-reproducible