fix: clicking annotation enters transcribe mode and scrolls to block
Some checks failed
CI / Unit & Component Tests (push) Has been cancelled
CI / Backend Unit Tests (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
CI / Unit & Component Tests (pull_request) Failing after 1m27s
CI / Backend Unit Tests (pull_request) Failing after 2m37s
CI / E2E Tests (pull_request) Failing after 1h28m16s

When clicking a turquoise annotation on the PDF:
- If not in transcribe mode, enters it and loads blocks
- Waits for DOM render, then scrolls to the corresponding block card

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Marcel
2026-04-05 21:18:43 +02:00
parent f3c29ffe58
commit 03d76863cb

View File

@@ -124,16 +124,22 @@ function handleBlockFocus(blockId: string) {
}
}
function handleAnnotationClick(annotationId: string) {
async function handleAnnotationClick(annotationId: string) {
activeAnnotationId = annotationId;
// In transcribe mode, focus the block that owns this annotation
if (transcribeMode) {
if (!transcribeMode) {
transcribeMode = true;
await loadTranscriptionBlocks();
}
// Wait for DOM to render the blocks, then scroll to the matching one
requestAnimationFrame(() => {
const block = transcriptionBlocks.find((b) => b.annotationId === annotationId);
if (block) {
const el = document.querySelector(`[data-block-id="${block.id}"]`);
el?.scrollIntoView({ behavior: 'smooth', block: 'nearest' });
}
}
});
}
// Load blocks when transcribe mode is entered