img-alt-present

<img> must have an alt attribute

automaticWCAG 1.1.1 (A)confidence: highseverity: seriousperceivable

Checks that <img> elements provide an alt attribute to support a text alternative mechanism.

Applies to. Applies to <img> elements included in the accessibility tree. Images with role="presentation" or role="none" are excluded only when they are not focusable, since a focusable one reverts to the img role under presentational roles conflict resolution. Hidden images are excluded whether or not they are focusable.

Expectation. Each applicable <img> element has an alt attribute. The alt attribute may be empty (alt="").

Examples

pass
<img src="image.png" alt="Green rectangle">

A non-empty `alt` is present.

fail
<img src="image.png">

No `alt` attribute at all (an empty `alt=""` would instead pass as decorative).

View source