How the outlet's scroll container should be reset after client-side
navigation.
"top" — scroll the outlet's nearest scrollable ancestor back to
the top. For a window-scrolled document that's document.scrollingElement
(matches what a full page load would do). For an app-shell layout where
scrolling lives inside a nested overflow-y: auto container (a common
100vh + overflow-y: auto main region), it's that inner container —
window.scrollTo would have been a no-op on such apps.
"preserve" — leave scroll position untouched. Useful for e.g. a
sidebar layout where sibling nav shouldn't disturb the main viewport.
Custom function — receives the from/to paths and returns an effect
the runtime awaits before the transition completes. Use for
sessionStorage-backed restoration, hash-anchor scrolling, or when
the auto-detected "top" target picks the wrong container.
ScrollBehavior only fires for pushPath / replacePath. Popstate
navigations (browser back/forward) are left to the browser's
history.scrollRestoration = "auto", which restores per-history-entry
positions correctly — better than a URL-keyed approximation could.
How the outlet's scroll container should be reset after client-side navigation.
"top"— scroll the outlet's nearest scrollable ancestor back to the top. For a window-scrolled document that'sdocument.scrollingElement(matches what a full page load would do). For an app-shell layout where scrolling lives inside a nestedoverflow-y: autocontainer (a common100vh + overflow-y: automain region), it's that inner container —window.scrollTowould have been a no-op on such apps."preserve"— leave scroll position untouched. Useful for e.g. a sidebar layout where sibling nav shouldn't disturb the main viewport.from/topaths and returns an effect the runtime awaits before the transition completes. Use forsessionStorage-backed restoration, hash-anchor scrolling, or when the auto-detected "top" target picks the wrong container.ScrollBehavior only fires for
pushPath/replacePath. Popstate navigations (browser back/forward) are left to the browser'shistory.scrollRestoration = "auto", which restores per-history-entry positions correctly — better than a URL-keyed approximation could.