diff --git a/frontend/src/lib/components/TranscriptionReadView.svelte b/frontend/src/lib/components/TranscriptionReadView.svelte index e713ee8a..c800037a 100644 --- a/frontend/src/lib/components/TranscriptionReadView.svelte +++ b/frontend/src/lib/components/TranscriptionReadView.svelte @@ -97,9 +97,11 @@ function currentViewport() { }; } -let closeTimer: ReturnType | null = null; +let closeTimer = $state | null>(null); function scheduleCardClose() { + // 150ms: long enough for pointer movement from mention to card, short enough + // to feel responsive. Matches the Radix/shadcn hover card delay. closeTimer = setTimeout(() => { activeCard = null; closeTimer = null; @@ -152,7 +154,7 @@ async function handleMentionEnter(event: Event) { } } -function handleMentionLeave(event: Event) { +function scheduleMentionLeave(event: Event) { const link = event.target as HTMLAnchorElement; link.removeAttribute('aria-describedby'); scheduleCardClose(); @@ -195,7 +197,7 @@ function attachMentionHandlers(node: HTMLElement) { } function onLeave(e: Event) { const t = e.target as HTMLElement; - if (t.matches?.(PERSON_MENTION_SELECTOR)) handleMentionLeave(e); + if (t.matches?.(PERSON_MENTION_SELECTOR)) scheduleMentionLeave(e); } function onClick(e: MouseEvent) { const t = e.target as HTMLElement;