Inline SVG icons are everywhere, and they are one of the most commonly missed accessibility cases. An SVG with no name is announced as nothing useful, while a decorative SVG that is not hidden floods a screen reader with shape data. This tool inspects a pasted SVG, decides which pattern it should follow, and checks that the required markup is present.
How it works
The tool parses your SVG with the browser’s XML parser, falling back to the HTML parser, and inspects the root svg element. It first decides the intended pattern:
- Decorative — the root has
aria-hidden="true"orrole="presentation"/role="none". The tool confirms it is hidden and warns if a straytitleoraria-labelwould leak a name. - Informative — anything else. The tool runs the accessible-name checks below.
For an informative SVG it verifies, in line with WCAG 1.1.1:
role="img"on the root, so the graphic is exposed as a single image.- A non-empty
titleelement, which is the short accessible name. aria-labelledbyon the root referencing thetitleelement’sid, so the name is announced reliably (anaria-labelis accepted as an alternative).- A resolvable accessible name overall.
- An optional
descelement for longer descriptions.
Example
<svg role="img" aria-labelledby="t">
<title id="t">Download file</title>
<path d="M12 3v12 ..."/>
</svg>
This passes: role="img" makes it one image, the title provides the name “Download file”, and aria-labelledby wires the two together. Remove the title and the icon becomes a nameless graphic.
Tips and notes
- Give each
titlea uniqueidand reference exactly that id fromaria-labelledby; a mismatch silently breaks the name. - Decorative icons that sit next to visible text should be hidden with
aria-hidden="true"rather than given a redundant name, to avoid double announcements. - Use
desconly when a short title is not enough, for example a data chart, and keep thetitleconcise. - All parsing happens locally in your browser; the markup never leaves the page.