id attributes must be unique
Rule
duplicate-id· Document, language & navigation · impact moderate · Static + live
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
<label for="x">A</label><input id="x"><input id="x">
<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.
1.3.1 Info and Relationships — Level A
Structure and relationships conveyed visually (headings, lists, tables, labels, groups) must also be available programmatically.
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 |