Dostępność
a11y/aria-hidden-focusable
aria-hidden="true" is never on a focusable element or on an element that contains one.
poważnastatyczneWCAG 4.1.2 · Afe-a11y-aria
Dlaczego
aria-hidden removes an element from what a screen reader announces but not from the Tab order. Keyboard focus then lands on something that has no name and no role: the user hears silence or "blank".
Poprawka
Hide content from everyone with hidden or inert (inert also removes it from focus and from pointer use), or take the controls out of the hidden part. Use aria-hidden="true" only on decoration such as icons and duplicated visuals with nothing focusable inside.
Przykłady
<!-- bad: an off-screen drawer hidden only from screen readers -->
<nav aria-hidden="true"><a href="/">Home</a></nav>
<!-- good -->
<nav inert><a href="/">Home</a></nav>
<svg aria-hidden="true" focusable="false">…</svg>Źródła
Fakty
- Identyfikator
a11y/aria-hidden-focusable- 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-hidden-focus, Lighthousearia-hidden-focus - Uczy jej skill
fe-a11y-ariaARIA, names and live regions- Od wersji
- 0.1.0
Przeczytaj w terminalu
npx github:dawidolko/frontend-skills explain a11y/aria-hidden-focusable