test(TranscriptionReadView): cover hover card timer and keyboard focus behavior

Five new tests verify:
- Card stays open when mouse moves mention → card (cancels 150ms timer)
- Card closes immediately on card mouseleave (no timer)
- Re-entering a mention cancels a pending close
- Card stays open when keyboard focus moves mention → card (WCAG 2.1.1)
- Card closes when keyboard focus leaves the card entirely

The keyboard tests drove adding onfocusin/onfocusout to PersonHoverCard's
root div, reusing the existing onmouseenter/onmouseleave callbacks so that
screen-reader and keyboard users get the same stay-open affordance as
mouse users. relatedTarget check prevents spurious closes on intra-card
focus movement.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Marcel
2026-04-29 21:23:44 +02:00
parent 96d9ff5db1
commit 9908f7afdc
2 changed files with 176 additions and 0 deletions

View File

@@ -94,6 +94,12 @@ const showMaidenName = $derived(
style:left={`${position.left}px`}
onmouseenter={onmouseenter}
onmouseleave={onmouseleave}
onfocusin={onmouseenter}
onfocusout={(e) => {
if (!(e.currentTarget as HTMLElement).contains(e.relatedTarget as Node | null)) {
onmouseleave?.();
}
}}
>
{#if state.status === 'loading'}
<div