diff options
| author | Fuwn <[email protected]> | 2026-05-19 02:41:45 +0000 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2026-05-19 02:41:45 +0000 |
| commit | 8d18d99bcb0de518dd0b60a1f7e022e0cf516efa (patch) | |
| tree | a96a0195a0cc778ba922cf5118cd34b6ad50b51e /src/routes/+layout.svelte | |
| parent | feat(nav): direction-aware view transitions, header excluded (diff) | |
| download | due.moe-8d18d99bcb0de518dd0b60a1f7e022e0cf516efa.tar.xz due.moe-8d18d99bcb0de518dd0b60a1f7e022e0cf516efa.zip | |
fix(nav): respect displayDisableAnimations in view transitions
Root.svelte already gated the fly transition on
\$settings.displayDisableAnimations, but the View Transition path
added in 7e2495bd ran unconditionally. The setting appeared broken
because the slide kept firing via the browser API.
Adds the same check to onNavigate via get(settings) (the callback is
not in reactive context, so a synchronous store read is the right
shape). When the setting is on, both transition paths bypass and
navigation snaps as expected.
Diffstat (limited to 'src/routes/+layout.svelte')
| -rw-r--r-- | src/routes/+layout.svelte | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index e2cb4132..a61d0a29 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -9,7 +9,7 @@ import settings from "$stores/settings"; import { browser } from "$app/environment"; import HeadTitle from "$lib/Home/HeadTitle.svelte"; import "../app.css"; -import { readable, type Readable } from "svelte/store"; +import { get, readable, type Readable } from "svelte/store"; import { navigating } from "$app/stores"; import { onNavigate } from "$app/navigation"; import NotificationsProvider from "$lib/Notification/NotificationsProvider.svelte"; @@ -94,6 +94,7 @@ $: if ($navigating) isMenuOpen = false; onNavigate((navigation) => { if (!("startViewTransition" in document)) return; if (window.matchMedia("(prefers-reduced-motion: reduce)").matches) return; + if (get(settings).displayDisableAnimations) return; const fromPath = navigation.from?.url.pathname ?? "/"; const toPath = navigation.to?.url.pathname ?? "/"; |