Dostępność
a11y/toast-timing
Toasts with actions or information the user needs do not disappear on a timer; others stay long enough and pause on hover and focus.
umiarkowanaręczneWCAG 2.2.1, 4.1.3 · Afe-a11y-carousel-toast
Dlaczego
A toast that offers "Undo" for five seconds is gone before a screen reader user hears it and finds the button, and before a magnifier user scrolls to it. The APG has no toast pattern; the rules come from the alert pattern and WCAG 2.2.1 and 4.1.3.
Poprawka
Announce toasts through one live region that is always present (role="status", role="alert" for errors). Do not auto-dismiss toasts that have a button or carry information the user must act on; keep them until closed. For short confirmations, show them for at least several seconds, pause the timer on hover and focus, and keep a close button. Never move focus into a toast; offer a keyboard path to its action (for example the same action in the page, or a documented shortcut).
Przykłady
// good: an undo toast stays until closed or used
showToast({ text: 'Message deleted', action: { label: 'Undo', run: undo }, timeout: null })Źródła
Fakty
- Identyfikator
a11y/toast-timing- Waga
- umiarkowana
- Sprawdzanie
- ręczne ocenia człowiek; raport podaje to jako listę kontrolną
- Dotyczy plików
page- WCAG 2.2
- 2.2.1, 4.1.3, poziom A
- Uczy jej skill
fe-a11y-carousel-toastCarousels and toasts- Od wersji
- 0.1.0
Przeczytaj w terminalu
npx github:dawidolko/frontend-skills explain a11y/toast-timing