Dostępność

a11y/img-alt

Every img and area element has an alt attribute; a decorative image has alt="".

krytycznastatyczneWCAG 1.1.1 · Afe-html

Dlaczego

Without alt, a screen reader announces the file name or nothing, and the image's meaning is lost; when the image fails to load, nothing replaces it.

Poprawka

Describe what the image says in this context (alt="Revenue grew 20% in 2026"), not what it looks like. For an image that only decorates, write alt="" so assistive technology skips it. An image inside a link that has no other text needs the link's purpose as its alt.

Przykłady

<!-- bad -->
<img src="chart.png">
<!-- good -->
<img src="chart.png" alt="Revenue grew 20% in 2026">
<img src="divider.svg" alt="">

Źródła

Fakty

Identyfikator
a11y/img-alt
Waga
krytyczna
Sprawdzanie
statyczne sprawdzane w kodzie źródłowym przez audit
Dotyczy plików
html angular vue svelte astro jsx
WCAG 2.2
1.1.1, poziom A
Ten sam problem w
axe-core image-alt, axe-core area-alt
Uczy jej skill
fe-html HTML documents and semantics
Od wersji
0.1.0

Plik reguły na GitHubie

Przeczytaj w terminalu

npx github:dawidolko/frontend-skills explain a11y/img-alt