Why it matters
- People who cannot see an image hear its text alternative instead. Without one, a screen reader may skip the image, or read its file name, such as «IMG_2034.jpg», which tells them nothing.
- WCAG 2.2 asks for a text alternative for every image that carries information (success criterion 1.1.1, level A).
- Google reads the text alternative to understand what an image shows.
Example
<img id="product" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAIAAABLbSncAAAAEklEQVR4nGP4z8CAFWEXHbQSACj/P8Fu7N9hAAAAAElFTkSuQmCC" width="160" height="160" />
<img id="product" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAIAAABLbSncAAAAEklEQVR4nGP4z8CAFWEXHbQSACj/P8Fu7N9hAAAAAElFTkSuQmCC" alt="زجاجة عطر العود الملكي" width="160" height="160" />
How to fix
- Add an
altthat says what the image shows or does, in the page's language:<img src="oud.jpg" alt="زجاجة عطر العود الملكي، 50 مل">. - For an image that only decorates, write an empty
alt="", so screen readers pass over it. - For an image that is a link or a button, say where it leads or what it does:
alt="السلة".
How we detect
- We render the page and run axe-core 4.13.0, the open-source accessibility engine by Deque, with its
image-altrule, in each engine. - The rule reports each image without a text alternative: no
alt,aria-labeloraria-labelledby, and not marked as decorative withalt=""orrole="presentation". - It does not apply to pages without images.