From 84ba728e080e53eef6cac3ba9dcd0b4420016e14 Mon Sep 17 00:00:00 2001 From: Marcel Date: Wed, 29 Apr 2026 21:30:23 +0200 Subject: [PATCH] feat(document-page): auto-open transcription panel when ?task=transcribe is present On mount, reads the task query param before the comment deep-link handler. When task=transcribe, opens the transcription panel, scrolls the close button into view, moves focus to it, then strips the param from the URL via replaceState. Co-Authored-By: Claude Sonnet 4.6 --- frontend/src/routes/documents/[id]/+page.svelte | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/frontend/src/routes/documents/[id]/+page.svelte b/frontend/src/routes/documents/[id]/+page.svelte index a62fb70c..fbec8612 100644 --- a/frontend/src/routes/documents/[id]/+page.svelte +++ b/frontend/src/routes/documents/[id]/+page.svelte @@ -362,6 +362,19 @@ onMount(() => { ); } + if (page.url.searchParams.get('task') === 'transcribe') { + transcribeMode = true; + tick().then(() => { + const closeBtn = document.querySelector('[data-testid="panel-close"]'); + closeBtn?.scrollIntoView({ + behavior: prefersReducedMotion ? 'instant' : 'smooth', + block: 'nearest' + }); + closeBtn?.focus({ preventScroll: true }); + replaceState(page.url.pathname, page.state ?? {}); + }); + } + scrollToCommentFromQuery(new URL(page.url), { transcribeMode, setTranscribeMode: (v) => (transcribeMode = v),