duplicate-id

IDs must be unique

automaticWCAG 4.1.1 (A)confidence: highseverity: moderaterobust

Checks that every non-empty id attribute value is unique within its own document or shadow tree (WCAG 2.0/2.1 SC 4.1.1, removed in WCAG 2.2).

Applies to. Applies to any element carrying a non-empty id attribute. Visibility is irrelevant. A duplicate id breaks the same lookups whether the element renders or not, which is why ACT 3ea0c8 evaluates hidden elements too.

Expectation. No other element in the same tree carries the same id value. Ids are scoped per document tree and per shadow tree, so the same id inside two different shadow roots is not a duplicate.

Examples

pass
<div id="section-1">First</div>
<div id="section-2">Second</div>

Each element has a distinct id.

fail
<div id="section-1">First</div>
<div id="section-1">Second</div>

The id `section-1` is used by two elements in the same tree, breaking `<label for>`, fragment links, and `getElementById`.

View source