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.

  1. 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

  2. aria-label

    Used when no aria-labelledby applies and the attribute carries text.

  3. <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

Rules across accessible names, decoration, structure, and references.
Code Severity WCAG Check
SVG-NAME-001error4.1.2role="img" with no accessible name
SVG-NAME-002error4.1.2aria-labelledby references a missing id
SVG-DECOR-003warning1.1.1No role, no name, not marked decorative
SVG-TITLE-004warning1.3.1<title> is not the first child of <svg>
SVG-DESC-005info1.1.1Named graphic without a <desc>
SVG-ID-006errorDuplicate id attributes
SVG-USE-007warning<use> points at an id that does not exist
SVG-FOCUS-008warning2.4.3tabindex on a non-interactive element

How a file is checked

The pipeline is static and has no rendering step.

  1. Parse

    fast-xml-parser builds a node tree, an id map, and the list of duplicate ids in one pass.

  2. Compute the name

    Resolve aria-labelledby, then aria-label, then the first child <title>, stopping at the first source that applies.

  3. Run the rules

    Eight rule functions read the tree and emit issues, each with a severity and a WCAG reference.

  4. Report

    Print text or JSON, write SARIF 2.1.0, and exit 0, 1, or 2 for CI.