From f3e2e102806b8a61cd5254608c381a7fdaf6e16e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arturo=20Guzm=C3=A1n=20P=C3=A9rez?= Date: Tue, 23 Jul 2024 10:27:57 +0100 Subject: [PATCH] feat: reset scroll on tab navigation --- src/lib/ui/nav/nav.svelte | 5 +++-- src/routes/[slug]/+layout.svelte | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/lib/ui/nav/nav.svelte b/src/lib/ui/nav/nav.svelte index bcfc7ed..7db8ce3 100644 --- a/src/lib/ui/nav/nav.svelte +++ b/src/lib/ui/nav/nav.svelte @@ -70,8 +70,9 @@ {/if} {#if $page.params.slug && $page.params.topic} { - goto(`/${$page.params.slug}/${e.detail}`) + on:click={async (e) => { + await goto(`/${$page.params.slug}/${e.detail}`) + document.getElementById('desktop-content')?.scrollTo(0, 0) }} topics={$page.data.topics} > diff --git a/src/routes/[slug]/+layout.svelte b/src/routes/[slug]/+layout.svelte index 0621737..d095fb4 100644 --- a/src/routes/[slug]/+layout.svelte +++ b/src/routes/[slug]/+layout.svelte @@ -79,6 +79,7 @@ {/if}