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
html angular vue svelte astro jsx
WCAG 2.2
4.1.2, poziom A
Ten sam problem w
axe-core aria-hidden-focus, Lighthouse aria-hidden-focus
Uczy jej skill
fe-a11y-aria ARIA, names and live regions
Od wersji
0.1.0

Plik reguły na GitHubie

Przeczytaj w terminalu

npx github:dawidolko/frontend-skills explain a11y/aria-hidden-focusable