diff --git a/src/routes/tutorial/[slug]/+page.svelte b/src/routes/tutorial/[slug]/+page.svelte index 1c660f572..144581bff 100644 --- a/src/routes/tutorial/[slug]/+page.svelte +++ b/src/routes/tutorial/[slug]/+page.svelte @@ -123,6 +123,21 @@ history.pushState({}, '', `?${q}`); } } + + /** @type {HTMLElement} */ + let sidebar; + + /** @type {import('./$types').Snapshot} */ + export const snapshot = { + capture: () => { + const scroll = sidebar.scrollTop; + sidebar.scrollTop = 0; + return scroll; + }, + restore: (scroll) => { + sidebar.scrollTop = scroll; + } + }; @@ -164,6 +179,7 @@
{ diff --git a/src/routes/tutorial/[slug]/Sidebar.svelte b/src/routes/tutorial/[slug]/Sidebar.svelte index 9c16fb68d..63fbb2838 100644 --- a/src/routes/tutorial/[slug]/Sidebar.svelte +++ b/src/routes/tutorial/[slug]/Sidebar.svelte @@ -1,6 +1,5 @@