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 <noreply@anthropic.com>
This commit is contained in:
Marcel
2026-04-29 21:30:23 +02:00
committed by marcel
parent d974d39d17
commit 7dc5dc6f71

View File

@@ -362,6 +362,19 @@ onMount(() => {
);
}
if (page.url.searchParams.get('task') === 'transcribe') {
transcribeMode = true;
tick().then(() => {
const closeBtn = document.querySelector<HTMLElement>('[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),