Elements containing role="img" have an alternative text

Rule ID: role-img-alt
User Impact: Serious
WCAG: 1.1.1

Compliance Data & Impact

User Impact

Disabilities Affected

  • Blind
  • Deafblind


  • Section 508: MUST

WCAG Success Criteria

  • 1.1.1 Non-text Content

Section 508 Guidelines

  • 1194.22 (a) Text equivalent for non-text elements

Rule Description

Ensures elements marked role="img" elements have alternate text.

Why it Matters

Screen readers have no way of translating an image into words that gets read to the user, even if the image only consists of text. As a result, it’s necessary for images to have short, descriptive and accessible alternative text so screen reader users clearly understand the image’s contents and purpose.

If you can’t see, all types of visual information, including images, are completely useless unless an accessible text alternative is provided which screen readers can convert into either sound or braille. People with low vision or color-blindness disabilities also require accessible alternative text to varying degrees.

Screen readers cannot convert visual image information to speech or braille in the absence of an accessible text alternative associated with the image.

How to Fix the Problem

Correct markup solutions

The following four markup examples all pass because each example contains markup rendered as alternative text:

<div id="match">Bananas</div>
<div role="img" aria-labelledby="match" id="pass2"></div>
<div id="hidden-match" style="display:none">Banana bombs</div>
<div role="img" aria-labelledby="hidden-match" id="pass3"></div>
<div role="img" aria-label="blah" id="pass1"></div>
<div role="img" title="title" id="pass4"></div>

Incorrect markup solutions

The following five exmaples fail the role-img-alt rule because the markup contains no corresponding and meaningful alternative text:

<div role="img" id="violation1"></div>
<div role="img" aria-label="" id="violation2"></div>
<div role="img" alt="blah" id="violation3"></div>
<div role="img" aria-labelledby="no-match" id="violation4"></div>
<div role="img" title="" id="violation5"></div>

The Algorithm (in simple terms)

Elements with the role="img" attribute value must also contain markup specifying accessible alternative text describing the image.