-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Page scroll position not reset to top on navigation (regression) #2733
Copy link
Copy link
Labels
bugSomething isn't workingSomething isn't workinghelp wantedPRs welcomed. The implementation details are unlikely to cause debatePRs welcomed. The implementation details are unlikely to cause debatep2-nice-to-haveSvelteKit cannot be used by a small number of people, quality of life improvements, etc.SvelteKit cannot be used by a small number of people, quality of life improvements, etc.routerscroll management
Milestone
Description
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workinghelp wantedPRs welcomed. The implementation details are unlikely to cause debatePRs welcomed. The implementation details are unlikely to cause debatep2-nice-to-haveSvelteKit cannot be used by a small number of people, quality of life improvements, etc.SvelteKit cannot be used by a small number of people, quality of life improvements, etc.routerscroll management
Type
Fields
Give feedbackNo fields configured for Bug.
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.svelteafter the last paragraph.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.1Severity
serious, but I can work around it
Additional Information
No response