-
-
Notifications
You must be signed in to change notification settings - Fork 348
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
[Filesystem Routing] Nested routes with sticky scrolling #1685
Comments
@brillout Usually in other metaframeworks there's two ways to navigate:
By default, the other metaframeworks work exactly like in regular HTML anchor tags wherein both approaches cause a scroll up to (0,0) scroll position. You can pass an optional prop/attribute to change that. In NextJS:
In SvelteKIt:
|
Do they also scroll to the top by default for nested layouts? I'm thinking of not scrolling nested route navigation by default. |
@brillout Just tested here, yup they do scroll to the top by default even for nested layouts. Repro: https://github.com/Blankeos/nested-layouts-scroll-example scroll-up-in-next-and-svelte.mp4Also tested "no scroll" while I'm at it: also-tested-no-scroll-while-im-at-it.mp4 |
Actually, I don't know whether a nested route should induce a scroll-to-the-top or not. Some nested layouts require a scroll while others don't, and I'm not sure which is more frequent. I'd suggest we stick to always scrolling by default. I think this ticket largely does the trick, with a much better DX than Next.js and SvelteKit. As always, feel free to disagree. |
Actually, a new setting |
Implemented by #1853. |
Description
By default Vike scrolls the page to the top upon navigation.
The idea here is that the user would define
/product/@id/%view
(or/product/@id/@@view/
) instead of/product/@id/@view
to tell Vike that the page shouldn't scroll to the top.Edit: Actually, a new setting
scroll: false
could be simpler.@Blankeos In Next.js (and other frameworks) how does the user control whether the page scrolls to the top?
The text was updated successfully, but these errors were encountered: