From 320f9fc76bbb2613dbde344e9f01c28708f96dac Mon Sep 17 00:00:00 2001 From: root Date: Wed, 8 Apr 2026 16:54:51 +0500 Subject: [PATCH] feat: add page fade transition and CSS performance improvements MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Wrap {#key} children in fade transition (out 100ms, in 180ms+60ms delay) for a smooth cross-fade between pages with no added dependencies - Halve navigation progress bar animation duration (8s → 4s) for more realistic feedback on typical navigations - Add prefers-reduced-motion media query to collapse all animation/transition durations for users with accessibility needs - Add content-visibility: auto on footer to skip browser paint of off-screen content and improve rendering performance --- ui/src/app.css | 19 ++++++++++++++++++- ui/src/routes/+layout.svelte | 6 ++++-- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/ui/src/app.css b/ui/src/app.css index 770d94d..8ad22ac 100644 --- a/ui/src/app.css +++ b/ui/src/app.css @@ -247,5 +247,22 @@ html { 100% { width: 100%; opacity: 0; } } .animate-progress-bar { - animation: progress-bar 8s cubic-bezier(0.1, 0.05, 0.1, 1) forwards; + animation: progress-bar 4s cubic-bezier(0.1, 0.05, 0.1, 1) forwards; +} + +/* ── Respect reduced motion — disable all decorative animations ─────── */ +@media (prefers-reduced-motion: reduce) { + *, + *::before, + *::after { + animation-duration: 0.01ms !important; + animation-iteration-count: 1 !important; + transition-duration: 0.01ms !important; + } +} + +/* ── Footer content-visibility — skip paint for off-screen footer ───── */ +footer { + content-visibility: auto; + contain-intrinsic-size: auto 80px; } diff --git a/ui/src/routes/+layout.svelte b/ui/src/routes/+layout.svelte index 0acddea..adcbeb0 100644 --- a/ui/src/routes/+layout.svelte +++ b/ui/src/routes/+layout.svelte @@ -13,7 +13,7 @@ import { locales, getLocale } from '$lib/paraglide/runtime.js'; import ListeningMode from '$lib/components/ListeningMode.svelte'; import SearchModal from '$lib/components/SearchModal.svelte'; - import { fly } from 'svelte/transition'; + import { fly, fade } from 'svelte/transition'; let { children, data }: { children: Snippet; data: LayoutData } = $props(); @@ -823,7 +823,9 @@
{#key page.url.pathname + page.url.search} - {@render children()} +
+ {@render children()} +
{/key}