canvas-text-alternative-present
<canvas> must provide a text alternative
automaticWCAG 1.1.1 (A)confidence: highseverity: seriousperceivable
Checks that <canvas> elements provide a text alternative via fallback content or an accessible name.
Applies to. Applies to <canvas> elements included in the accessibility tree. Hidden elements are excluded whether or not they are focusable.
Expectation. Each applicable <canvas> provides a text alternative via fallback content or an accessible name, with two exceptions:
- role="img" (the first token of the role attribute that names a known role, matched case-insensitively) makes the canvas's children presentational and its name comes from the author only, so fallback content does not count: aria-labelledby, aria-label or title must name it.
- role="none"/"presentation" (resolved the same way) marks the canvas decorative, and it passes. The role is ignored (presentational role conflict) when the canvas is focusable or carries aria-label/aria-labelledby, and the canvas is then judged like any other.
Examples
pass
<canvas>Chart summary</canvas>
Fallback content between the tags provides a text alternative.
fail
<canvas></canvas>
No fallback content and no accessible name.