Accessibility Wiki

id attributes must be unique

Rule duplicate-id · Document, language & navigation · impact moderate · Static + live

↩ Back to the rules index · WCAG cross-reference

Why it matters

Duplicate ids break the ARIA reference graph: aria-labelledby, for, headers and friends resolve to the first match, so labels and relationships attach to the wrong element. (WCAG 4.1.1 was removed in 2.2, but the breakage is real and maps to 1.3.1.)

How to fix

Ensure each id is used once. Generate unique ids for repeated components.

Example

✕ Fails
<label for="x">A</label><input id="x"><input id="x">
✓ Passes
<label for="x">A</label><input id="x"><input id="y">

WCAG success criteria

4.1.1 Parsing (obsolete) — Level A (obsolete in WCAG 2.2)

Historically required well-formed markup (unique ids, proper nesting). Removed in WCAG 2.2, but duplicate ids still break ARIA references and labels.

Understanding 4.1.1

1.3.1 Info and Relationships — Level A

Structure and relationships conveyed visually (headings, lists, tables, labels, groups) must also be available programmatically.

Understanding 1.3.1

Standards

This rule contributes to the following standards:

WCAG A EN 301 549

Standard Criteria
EN 301 549 9.4.1.1, 9.1.3.1

References