site: fix scroll restoration (#9222)

pull/7376/head
Puru Vijay 10 months ago committed by GitHub
parent 408ab77420
commit 6aca6127ca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -7,6 +7,20 @@
import '@sveltejs/site-kit/styles/index.css';
export let data;
/** @type {import('@sveltejs/kit').Snapshot<number>} */
let shell_snapshot;
export const snapshot = {
capture() {
return {
shell: shell_snapshot?.capture()
};
},
restore(data) {
shell_snapshot?.restore(data.shell);
}
};
</script>
<svelte:head>
@ -18,7 +32,7 @@
</svelte:head>
<div style:display={$page.url.pathname !== '/docs' ? 'contents' : 'none'}>
<Shell nav_visible={$page.url.pathname !== '/repl/embed'}>
<Shell nav_visible={$page.url.pathname !== '/repl/embed'} bind:snapshot={shell_snapshot}>
<Nav slot="top-nav" title={data.nav_title} links={data.nav_links}>
<svelte:fragment slot="home-large">
<strong>svelte</strong>.dev

Loading…
Cancel
Save