Bug description
Normally when hitting the browser's refresh button, browsers restore the scroll position from before the refresh (you can try that on pretty much any website, e.g. https://www.nytimes.com/).
With Unpoly, this behavior breaks - presumably because it sets window.history.scrollRestoration = 'manual'.
Reproduction project
Steps to reproduce the behavior:
- Scroll to the bottom of the page
- Hit F5 / the browser's refresh button
- Note that unlike standard browser behavior, the scroll position has been reset to the top of the page
Expected behavior
Refreshing the page should behave like the standard browser behavior and keep the original scroll position.
Browser version
- OS: Ubuntu Linux 20.04
- Browser Chromium, Firefox
Additional info
I'm sure there's good reason to set scrollRestoration to manual when working with the history API. In my case I don't use Unpoly for full page navigation and I workaround this unwanted behavior with the following snippet:
window.addEventListener("pagehide", () => {
window.history.scrollRestoration = "auto";
});