svg-text-alternative-present
<svg> must provide a text alternative
Checks that inline <svg> elements provide a text alternative via a <title> element or an ARIA name (a <desc> element alone does not count).
Applies to. Applies to inline <svg> elements that are exposed to assistive technologies AND appear intended to be conveyed. "Intended to be conveyed" is approximated deterministically by at least one of:
- role="img", role="graphics-symbol", or role="graphics-document" on the SVG root element itself (the WAI-ARIA Graphics Module roles, alongside img). Does NOT extend to arbitrary role="img"/"graphics-symbol"/"graphics-document" descendants nested inside an <svg>. This check's scope is the <svg> root only; role-img-text-alternative-present covers those same three roles on any other element, including nested SVG shapes (ACT 7d6734's own failed example: a bare
<svg>root with a nested<circle role="graphics-symbol">). - a non-blank aria-label / aria-labelledby (aria-label="" names nothing and signals no intent)
- <title> or <desc> present as a direct child, wherever it is among the children (SVG-AAM); the first of each counts (desc alone is an applicability signal only, see @expectation)
- focusable/tabbable (e.g., tabindex, native focusability)
Images with role="presentation" or role="none" are excluded only when they are not focusable. Elements otherwise hidden from the accessibility tree remain applicable if they are tabbable-focusable or referenced by IDREF relationships (per engine eligibility checks).
Expectation. Each applicable <svg> element provides a text alternative via:
- non-empty text in its first direct child <title>, wherever it is among the children (an empty first <title> names nothing), OR
- an ARIA name (aria-label / aria-labelledby).
A <desc> element alone does NOT satisfy this, per the SVG Accessibility API Mappings spec §7.1, <desc> only ever contributes to the accessible DESCRIPTION, never the accessible NAME. An <svg> with only a <desc> and no <title>/ARIA name is still "applicable" (desc signals authorial intent) but fails.
Examples
<svg role="img"><title>Close</title></svg>
<title> provides the accessible name for an SVG with an explicit img role.
<svg role="img"></svg>
No <title> or ARIA name. A <desc> alone wouldn't do: it describes the image, it doesn't name it.