# Role Img Alt

> Elements with role="img" must have an accessible name provided through aria-label, aria-labelledby, title, or another valid method.

Source: https://knowledge.evinced.com/web/web-validations/role-img-alt

Elements with `role="img"` must have an accessible name provided through `aria-label`, `aria-labelledby`, `title`, or another valid method.

Assistive technologies treat any element carrying `role="img"` as an image. When that element lacks a text alternative, people who rely on screen readers receive no information about what the “image” represents. Supplying a brief, descriptive text alternative ensures everyone can understand the content and purpose conveyed by the visual.

## Pass Patterns

### Accessible name via `aria-label`

The `aria-label` attribute provides a text description directly on the element.

```html
<style>
    .cart-ico {
        background-image: url("/images/cart.svg");
    }
</style>


<div role="img" aria-label="Shopping cart" class="cart-ico"></div>
```

### Accessible name via `aria-labelledby`

The `aria-labelledby` attribute references a visible element and uses its text as the accessible name.

```html
<style>
    .logo-container {
        background-image: url("/images/logo.png");
    }
</style>


<h4 id="logo-desc">Evinced company logo</h4>
<div role="img" class="logo-container" aria-labelledby="logo-desc"></div>
```

### Accessible name via the `title` attribute

The `title` attribute provides an accessible name when no other labeling method is used.

```html
<style>
    .warn-ico {
        background-image: url("/images/warning.svg");
    }
</style>


<div role="img" class="warn-ico" title="Warning"></div>
```

## Fail Patterns

### No text alternatives

The element has no `aria-label`, `aria-labelledby`, or `title`, so it has no accessible name.

```html
<style>
    .cart-ico {
        background-image: url("/images/cart.svg");
    }
</style>


<div role="img" class="cart-ico"></div>
```

### Empty `aria-label` value

An empty `aria-label` provides no name.

```html
<style>
    .logo-container {
        background-image: url("/images/logo.png");
    }
</style>


<div role="img" class="logo-container" aria-label=""></div>
```

### Invalid `alt` attribute on a `<div>` element

The `alt` attribute is only valid on elements such as `<img>`, so it doesn't name a `<div>`.

```html
<style>
    .warn-ico {
        background-image: url("/images/warning.svg");
    }
</style>


<div role="img" class="warn-ico" alt="Warning"></div>
```

### Using a text node as the only description

Text inside the element with `role="img"` does not contribute to the accessible name, so screen readers announce it as unnamed.

```html
<style>
    .cart-ico {
        background-image: url("/images/cart.svg");
    }
</style>


<div role="img" class="cart-ico">Shopping cart</div>
```

### Empty `title` attribute

An empty `title` provides no name.

```html
<style>
    .warn-ico {
        background-image: url("/images/warning.svg");
    }
</style>


<div role="img" class="warn-ico" title=""></div>
```

## WCAG techniques

### Sufficient techniques

-   [ARIA10: Using aria-labelledby to provide a text alternative for non-text content](https://www.w3.org/WAI/WCAG22/Techniques/aria/ARIA10)

### Failure techniques

-   [F3: Failure of Success Criterion 1.1.1 due to conveying information exclusively using CSS background images](https://www.w3.org/WAI/WCAG22/Techniques/failures/F3)
-   [F65: Failure of Success Criterion 1.1.1 due to omitting the alt attribute or text alternative on img elements, area elements, and input elements of type "image"](https://www.w3.org/WAI/WCAG22/Techniques/failures/F65)

## ACT Rules

-   [Image has non-empty accessible name](https://www.w3.org/WAI/standards-guidelines/act/rules/23a2a8/)

## Try It Yourself

### Using a screen reader

**New to screen reader testing, or need a refresher?**  
Review this article first: [Practical guides for using screen readers](https://knowledge.evinced.com/a11y-essentials/practical-guides-for-using-screen-readers)

1.  Load the page and open a screen reader.
2.  Move the virtual cursor onto the element with `role="img"`.

**Expected results:** The screen reader announces a meaningful description.

**Actual results:** Nothing (or “*graphic*”) is announced, so the user cannot perceive the content.

### Inspecting the browser dev-tools

1.  Inspect the page in devtools and open the Accessibility pane.
2.  Select an element with `role="img"`.
3.  Check the Name field.

**Expected results:** The Name field lists the alternative text supplied via `aria-label`, `aria-labelledby`, or `title`.

**Actual results:** The Name field is empty, confirming the missing text alternative.

## FAQ

**How does this issue relate to 1.1.1 Non-text Content?**

SC 1.1.1 Non-text Content requires every non-text element to have a text alternative that serves the same purpose. An element carrying `role="img"` is treated as non-text content, so an accessible name is mandatory.

**Why is this issue marked as Serious?**

Without an accessible name, users who rely on screen readers receive no information about the image. They may miss essential cues, instructions, or branding. Because the problem creates a direct barrier to perceiving content across all modern browsers and assistive technologies, its impact is considered serious.

## Standards and Regulations

| Standard | Success Criterion | Reference |
| --- | --- | --- |
| WCAG 2.2 | [1.1.1 Non-text Content](https://www.w3.org/TR/WCAG22/#non-text-content) (A) | All non-text content that is presented to the user has a text alternative that serves the equivalent purpose, except for controls/input, time-based media, tests, sensory experiences, CAPTCHA, and decoration/formatting/invisible content. |
| EN 301 549 | [9.1.1.1 Non-text Content](https://www.etsi.org/standards/etsi-301-549) | Same as the WCAG text. |
| Section 508 | [1194.22(a)](https://www.federalregister.gov/documents/2018/01/18/2018-00712/section-508-standards-update#d22) | A text equivalent for every non-text element shall be provided (e.g., via “\`alt\`”, “\`longdesc\`”, or in-element content). |
| 508 Trusted Tester | [1.1.1-meaningful-image-name, 7.A](https://section508coordinators.github.io/TrustedTester/images.html#check-111-meaningful-image-name) | The accessible name and accessible description for a meaningful image provides an equivalent description of the image. |
| 508 Trusted Tester | [1.1.1-decorative-image, 7.B](https://section508coordinators.github.io/TrustedTester/images.html#check-111-decorative-image) | There is no accessible name and accessible description for a decorative image. |

## Personas impacted by this issue

-   [Screen Reader](https://knowledge.evinced.com/a11y-essentials/personas#screen-reader)
-   [Braille](https://knowledge.evinced.com/a11y-essentials/personas#braille)

## Learn More

-   [Writing Effective Text Alternatives for Images](https://knowledge.evinced.com/a11y-essentials/writing-effective-text-alternatives-for-images)

## Related Issues

-   [area-alt](https://knowledge.evinced.com/web/web-validations/area-alt)
-   [input-image-alt](https://knowledge.evinced.com/web/web-validations/input-image-alt)
-   [image-alt](https://knowledge.evinced.com/web/web-validations/image-alt)
-   [object-alt](https://knowledge.evinced.com/web/web-validations/object-alt)
-   [svg-img-alt](https://knowledge.evinced.com/web/web-validations/svg-img-alt)
