Skip to content

Commit

Permalink
fix: scrolling when navigate
Browse files Browse the repository at this point in the history
TODO: remove when it will be fixed: sveltejs/kit#2733
  • Loading branch information
artegoser committed Mar 2, 2024
1 parent 763d9a9 commit 5bb0885
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/routes/+layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import Navigation from "$lib/components/Navigation.svelte";
import { Icon, Bars3 } from "svelte-hero-icons";
import { afterNavigate } from "$app/navigation";
initializeStores();
Expand All @@ -35,6 +36,10 @@
function drawerOpen(): void {
drawerStore.open({});
}
afterNavigate(() => {
document.getElementById("page")?.scrollTo(0, 0);
});
</script>

<Drawer>
Expand Down Expand Up @@ -75,5 +80,7 @@
</AppBar>
</svelte:fragment>
<!-- Page Route Content -->
<slot />
<div id="page">
<slot />
</div>
</AppShell>

0 comments on commit 5bb0885

Please sign in to comment.