SIA-R3id attributes have a unique value

Accessibility requirements

This rule is not required for conformance to any accessibility requirements.

Description

This rule checks that id attributes have a unique value.

Applicability

This rule applies to every id attribute with a value that is not empty.

Expectations

  1. The value of the attribute is unique across all other id attributes specified on elements that exist within the same document tree or shadow tree as the element on which the applicable id attribute is specified.

Assumptions

This rule makes no assumptions.

Accessibility support

This rule has no known accessibility support concerns.

Examples

Passed

These elements all have a different ids and therefore pass the rule:

<div id="my-div1">This is my first element</div>
<span id="my-div2">This is my second element</span>
<svg id="my-div3">This is my third element</svg>

Failed

These elements have the same id and therefore fail the rule:

<div id="my-div">This is my first element</div>
<span id="my-div">This is my second element</span>

Inapplicable

This element has no id and is therefore inapplicable:

<div>This is my first element</div>

Acknowledgments

This document includes material copied from or derived from https://www.w3.org/WAI/standards-guidelines/act/rules/3ea0c8/. Copyright © 2024 W3C® (MIT, ERCIM, Keio, Beihang).