Dostępność

a11y/hover-content-dismissible

Tooltips and popups shown on hover or focus close with Escape, stay while the pointer moves onto them, and do not vanish on a timer.

umiarkowanaręczneWCAG 1.4.13 · AAfe-a11y-visual

Dlaczego

A tooltip that covers what a magnifier user is reading, cannot be closed, or disappears when the pointer moves onto it to read it, blocks people who zoom or move the pointer slowly.

Poprawka

Show it on hover and on keyboard focus, close it on Escape without moving focus, keep it open while the pointer is over the trigger or the tooltip (no gap between them), and never hide it on a timeout. Interactive content belongs in a popover or disclosure, not a tooltip.

Przykłady

// good: Escape closes the tooltip without moving focus
trigger.addEventListener('keydown', (e) => { if (e.key === 'Escape') tooltip.hidden = true })

Źródła

Fakty

Identyfikator
a11y/hover-content-dismissible
Waga
umiarkowana
Sprawdzanie
ręczne ocenia człowiek; raport podaje to jako listę kontrolną
Dotyczy plików
page
WCAG 2.2
1.4.13, poziom AA
Uczy jej skill
fe-a11y-visual Contrast, colour, size and reflow
Od wersji
0.1.0

Plik reguły na GitHubie

Przeczytaj w terminalu

npx github:dawidolko/frontend-skills explain a11y/hover-content-dismissible