Page scroll position not reset to top on navigation (regression)
#2733 opened on Nov 3, 2021
Description
Describe the bug
When navigating to a new page, if you are already scrolled partway down the page, the next page load will keep the current scroll position and not scroll back to the top.
I believe this broke with next-193. When I install next-192, this does not happen -- navigating to a new page always scrolls to the top, just like regular browser navigation.
Reproduction
Init the SvelteKit demo project. Add the following paragraph in about.svelte after the last paragraph.
<p>Go <a href="/">home</a></p>
Make the browser window small enough so that the page scrolls and scroll to the bottom of the page. Click the Home link. The Home page loads, but does not scroll to the top (i.e. the nav bar is not visible).
.
Tested in Chrome and Firefox on Windows 10.
Logs
No response
System Info
System:
OS: Linux 4.19 Ubuntu 20.04.1 LTS (Focal Fossa)
CPU: (4) x64 Intel(R) Core(TM) i7-6600U CPU @ 2.60GHz
Memory: 7.79 GB / 12.40 GB
Container: Yes
Shell: 5.0.17 - /bin/bash
Binaries:
Node: 14.17.0 - ~/.nvm/versions/node/v14.17.0/bin/node
Yarn: 1.22.5 - /usr/bin/yarn
npm: 8.1.1 - ~/.nvm/versions/node/v14.17.0/bin/npm
Browsers:
Chrome: 89.0.4389.90
npmPackages:
@sveltejs/kit: ^1.0.0-next.193 => 1.0.0-next.193
svelte: ^3.34.0 => 3.44.1
Severity
serious, but I can work around it
Additional Information
No response