jsx-a11y/alt-text
Require alternative text on img, area, input[type='image'], and object elements so screen readers can describe them.
- Category: Accessibility
- Severity: error
- Source:
oxlint-builtin:jsx-a11y - Framework: global
- Enabled when: always (unless customRulesOnly=true)
- Documentation: https://oxc.rs/docs/guide/usage/linter/rules/jsx_a11y/alt-text
Validation prompt
Use this to decide whether a fired diagnostic is real or a false positive.
Fires on img, object, area, and input[type='image'] elements lacking an accessible name — img/area need a non-empty alt (or alt='' for purely decorative), object needs inner text or title/aria-label/aria-labelledby, and input[type='image'] needs alt or aria-label/aria-labelledby. False positive: spread props like <img {...props} /> can forward alt invisibly to the static check.
Fix prompt
Use this once validation confirms the diagnostic is real.
Add a descriptive alt that conveys the image's purpose (alt='Logo of Acme Corp'), or alt='' for purely decorative images — avoid role='presentation' or role='none' since empty alt is preferred. For object/area, use aria-label or descriptive inner text. For input[type='image'], the alt describes the button action. See https://oxc.rs/docs/guide/usage/linter/rules/jsx_a11y/alt-text
Related rules
More Accessibility rules from the rules reference:
react-doctor/alt-text: Require alternative text on img, area, input[type='image'], and object elements so screen readers can describe them.react-doctor/anchor-ambiguous-text: Describe a link's destination — avoid bare 'click here' / 'learn more' / 'link' as the only link text.react-doctor/anchor-has-content: Add visible or aria-labelled text inside every `<a>`.react-doctor/anchor-is-valid: Require anchors to navigate to a real destination — use a button for click-only actions instead of href='#' or javascript:void(0).react-doctor/aria-activedescendant-has-tabindex: Add `tabIndex` to elements with `aria-activedescendant` so they're keyboard-focusable.