diff --git a/ui/src/lib/components/ListeningMode.svelte b/ui/src/lib/components/ListeningMode.svelte index e9cb86c..eb016ea 100644 --- a/ui/src/lib/components/ListeningMode.svelte +++ b/ui/src/lib/components/ListeningMode.svelte @@ -34,6 +34,14 @@ // ── Chapter search ──────────────────────────────────────────────────────── let chapterSearch = $state(''); + + // Scroll the current chapter into view instantly (no animation) when the + // chapter modal opens. Applied to every chapter button; only scrolls when + // the chapter number matches the currently playing one. Runs once on mount + // before the browser paints so no scroll animation is ever visible. + function scrollIfActive(node: HTMLElement, isActive: boolean) { + if (isActive) node.scrollIntoView({ block: 'center', behavior: 'instant' }); + } const filteredChapters = $derived( chapterSearch.trim() === '' ? audioStore.chapters @@ -386,11 +394,12 @@