Reference
The rules
Eight checks over one computed value: the accessible name. Each rule describes a specific way a standalone graphic breaks, and carries the WCAG reference it answers to.
How the name is computed
iconlens follows the SVG-AAM priority order and stops at the first source that yields a non-empty name. This is the same order a browser uses when it builds the accessibility tree.
-
aria-labelledby
Each referenced id is resolved and its text concatenated, in order. A reference to a missing id is itself a finding (
SVG-NAME-002).wins first
-
aria-label
Used when no
aria-labelledbyapplies and the attribute carries text. -
<title>
The first child
<title>of the root<svg>. A title anywhere else is ignored and flagged (SVG-TITLE-004).
If none of the three apply, the graphic has no accessible name, and the rules say so.
<svg xmlns="http://www.w3.org/2000/svg" role="img" aria-labelledby="t">
<title id="t">Company logo</title>
<path d="…" />
</svg>
The eight rules
| Code | Severity | WCAG | Check |
|---|---|---|---|
SVG-NAME-001 | error | 4.1.2 | role="img" with no accessible name |
SVG-NAME-002 | error | 4.1.2 | aria-labelledby references a missing id |
SVG-DECOR-003 | warning | 1.1.1 | No role, no name, not marked decorative |
SVG-TITLE-004 | warning | 1.3.1 | <title> is not the first child of <svg> |
SVG-DESC-005 | info | 1.1.1 | Named graphic without a <desc> |
SVG-ID-006 | error | — | Duplicate id attributes |
SVG-USE-007 | warning | — | <use> points at an id that does not exist |
SVG-FOCUS-008 | warning | 2.4.3 | tabindex on a non-interactive element |
How a file is checked
The pipeline is static and has no rendering step.
-
Parse
fast-xml-parserbuilds a node tree, an id map, and the list of duplicate ids in one pass. -
Compute the name
Resolve
aria-labelledby, thenaria-label, then the first child<title>, stopping at the first source that applies. -
Run the rules
Eight rule functions read the tree and emit issues, each with a severity and a WCAG reference.
-
Report
Print text or JSON, write SARIF 2.1.0, and exit
0,1, or2for CI.