Skip to content

jsx_a11y/alt-text Correctness ​

What it does ​

Enforce that all elements that require alternative text have meaningful information to relay back to the end user.

Why is this necessary? ​

Alternative text is a critical component of accessibility for screen reader users, enabling them to understand the content and function of an element.

What it checks ​

This rule checks for alternative text on the following elements: <img>, <area>, <input type="image">, and <object>.

How to fix it ​

Ensure that the alt attribute is present and contains meaningful text that describes the element's content or purpose.

Example ​

Examples of incorrect code for this rule:

jsx
<img src="flower.jpg" alt="A close-up of a white daisy" />

Examples of correct code for this rule:

jsx
<img src="flower.jpg" />

References ​

Released under the MIT License.