[role="img"] and [role="image"] elements must have alternative text

How to fix the role-img-alt accessibility rule. Images and text alternatives.

What this rule checks

Ensure [role="img"] and [role="image"] elements have alternative text

Who is affected

An element marked role="img" has no text alternative, so it is silent to screen readers.

How to fix it

Add an aria-label (or aria-labelledby) describing the image.

Example

Before

<div role="img" class="chart"></div>

After

<div role="img" class="chart" aria-label="Sales rose 20% from 2024 to 2025"></div>

WCAG success criteria

When this rule fails, the page fails:

Find it on your own page

Scan a web page and the report lists every element that fails this rule, with screenshots outlining where they are, the code, and a selector you can paste into your browser’s developer tools.

More detail