Skip to content

Commit

Permalink
feat: reset scroll on tab navigation
Browse files Browse the repository at this point in the history
  • Loading branch information
artgpz committed Jul 23, 2024
1 parent 27d0c4d commit f3e2e10
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/lib/ui/nav/nav.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,9 @@
{/if}
{#if $page.params.slug && $page.params.topic}
<NavTopics
on:click={(e) => {
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}
></NavTopics>
Expand Down
1 change: 1 addition & 0 deletions src/routes/[slug]/+layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@
{/if}
</div>
<div
id="desktop-content"
class="slug-layout-right-col relative col-span-1 col-start-2 row-span-1 row-start-1 h-full w-full overflow-y-scroll"
>
<button
Expand Down

0 comments on commit f3e2e10

Please sign in to comment.