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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user