Dostępność
a11y/dialog-name
Every dialog has an accessible name, usually aria-labelledby pointing at its visible heading.
poważnastatyczneWCAG 4.1.2 · Afe-a11y-dialog
Dlaczego
When a dialog opens, a screen reader announces its name and role first. Without a name the user hears only "dialog" and must explore it to learn whether it is a confirmation, an error or a form.
Poprawka
Give the dialog a visible heading with an id and set aria-labelledby to it; use aria-label only when there is no visible title. For an alert dialog, also point aria-describedby at the message.
Przykłady
<!-- bad -->
<dialog><h2>Delete project?</h2>…</dialog>
<!-- good -->
<dialog aria-labelledby="del-title"><h2 id="del-title">Delete project?</h2>…</dialog>Źródła
Fakty
- Identyfikator
a11y/dialog-name- Waga
- poważna
- Sprawdzanie
- statyczne sprawdzane w kodzie źródłowym przez
audit - Dotyczy plików
htmlangularvuesvelteastrojsx- WCAG 2.2
- 4.1.2, poziom A
- Ten sam problem w
- axe-core
aria-dialog-name - Uczy jej skill
fe-a11y-dialogDialogs and modals- Od wersji
- 0.1.0
Przeczytaj w terminalu
npx github:dawidolko/frontend-skills explain a11y/dialog-name