# ember/template-require-valid-alt-text 💼 This rule is enabled in the 📋 `template-lint-migration` [config](https://github.com/ember-cli/eslint-plugin-ember#-configurations). Enforce that all elements that require alternative text have meaningful information to relay back to the end user. This is a critical component of accessibility for screenreader users in order for them to understand the content's purpose on the page. By default, this rule checks for alternative text on the following elements: ``, ``, ``, and ``. Enforce `img` alt attribute does not contain the word image, picture, or photo. Screen readers already announce `img` elements as an image. There is no need to use words such as _image_, _photo_, and/or _picture_. The rule will first check if `aria-hidden` is true to determine whether to enforce the rule. If the image is hidden, then rule will always succeed. ## Examples This rule **forbids** the following: ### `` An `` must have the `alt` attribute. It must have either meaningful text, or be an empty string. The content of an `alt` attribute is used to calculate the machine-readable label of an element, whereas the text content is used to produce a label for the element. For this reason, adding a label to an icon can produce a confusing or duplicated label on a control that already has appropriate text content. If it's not a meaningful image, it should have an empty alt attribute value and have the role of presentation or none. `img` alt attribute does not contain the word image, picture, or photo. Screen readers already announce `img` elements as an image. There is no need to use words such as _image_, _photo_, _logo_, _spacer_, and/or _picture_. Numbers are not considered valid alt text, and this rule disallows using only numbers in alt text. This rule **forbids** the following: ```gjs ``` This rule **allows** the following: ```gjs ``` ### `` Add alternative text to all embedded `` elements using either inner text, setting the `title` prop, or using the `aria-label` or `aria-labelledby` props. Note, the `title` prop is generally less reliable than the alternatives. Some screen readers will not read this value aloud, leaving no description of the non-text content. This rule **forbids** the following: ```gjs ``` This rule **allows** the following: ```gjs ``` ### `` All `` elements must have a non-empty `alt` prop set with a meaningful description of the image or have the `aria-label` or `aria-labelledby` props set. This rule **forbids** the following: ```gjs ``` This rule **allows** the following: ```gjs ``` ### `` All clickable `` elements within an image map have an `alt`, `aria-label` or `aria-labelledby` prop that describes the purpose of the link. This rule **forbids** the following: ```gjs ``` This rule **allows** the following: ```gjs ``` ## References - [WCAG Technique- using alt attributes on img elements](https://www.w3.org/TR/WCAG20-TECHS/H37.html) - [WCAG Criterion 1.1.1 - Non-text Content](https://www.w3.org/WAI/WCAG21/Understanding/non-text-content.html) - [HTML 5.2 spec - the img element](https://www.w3.org/TR/html5/semantics-embedded-content.html#the-img-element) - [Failure of Success Criterion 1.1.1 due to providing a text alternative that is not null (e.g., alt="spacer" or alt="image") for images that should be ignored by assistive technology](https://www.w3.org/WAI/WCAG21/Techniques/failures/F39)