Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect scrolling when navigating between pages #2720

Closed
NewNik opened this issue Nov 1, 2021 · 2 comments
Closed

Incorrect scrolling when navigating between pages #2720

NewNik opened this issue Nov 1, 2021 · 2 comments

Comments

@NewNik
Copy link

NewNik commented Nov 1, 2021

Describe the bug

When switching between pages with different scrolls and returning to the previous page, the scroll becomes in the wrong position.

Reproduction

Error example: https://github.com/NewNik/svelteKit-scroll
The example has a commented-out piece of code that solves the problem, but this is a dirty hack.
https://github.com/NewNik/svelteKit-scroll/blob/master/src/routes/__layout.svelte
Possible solution: add tick from svelte before DOM interaction here https://github.com/sveltejs/kit/blob/master/packages/kit/src/runtime/client/renderer.js#L277
image
In this case, the scroll will have to take place on a new rendered page.

Logs

No response

System Info

System:
    OS: Windows 10 10.0.19042
    CPU: (12) x64 Intel(R) Core(TM) i7-10750H CPU @ 2.60GHz 
    Memory: 21.17 GB / 31.83 GB
  Binaries:
    Node: 14.15.1 - C:\Program Files\nodejs\node.EXE        
    Yarn: 1.22.5 - C:\Program Files (x86)\Yarn\bin\yarn.CMD 
    npm: 6.14.8 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: Spartan (44.19041.1266.0), Chromium (95.0.1020.40)
    Internet Explorer: 11.0.19041.1202
  npmPackages:
    @sveltejs/kit: next => 1.0.0-next.192
    svelte: ^3.42.6 => 3.44.1

Severity

serious, but I can work around it

Additional Information

No response

@bluwy
Copy link
Member

bluwy commented Nov 2, 2021

Actually we have #2668 merged that fixes this behaviour, it should be released soon.

@Conduitry
Copy link
Member

Closing as duplicate of #2664.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants