Id attribute is unique

  • Rule Typeatomic
  • Rule ID: 3ea0c8
  • Last modified: Aug 21, 2019
  • Accessibility Requirements Mapping
    • 4.1.1 Parsing (Level: A)
      • Learn More about 4.1.1 (Parsing)
      • Required for conformance to WCAG 2.0 and above on level A and above
      • Outcome mapping:
        • Any failed outcomes: not satisfied
        • All passed outcomes: further testing is needed
        • An inapplicable outcome: further testing is needed
  • Input Aspects

Description

This rule checks that all id attribute values on a single page are unique.

Applicability

Any id attribute which is not the empty string (""), specified on an HTML or SVG element.

Note: Elements that are neither included in the accessibility tree nor visible are still considered for this rule.

Expectation

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

Assumptions

There are currently no assumptions.

Accessibility Support

There are no major accessibility support issues known for this rule.

Background

Test Cases

Passed

Passed Example 1

Only one id within the document context

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

Passed Example 2

All ids are unique within the document context

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

Passed Example 3

id in shadow DOM is for the same element as id in light DOM

<div id="my-elm"></div>
<script>
	var myElm = document.getElementById('my-elm')
	var shadow = myElm.attachShadow({ mode: 'open' })
	shadow.innerHTML = '<b id="my-elm" ><slot></slot></b>'
</script>

Failed

Failed Example 1

Several elements have identical id

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

Failed Example 2

Elements of different types have identical id

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

Failed Example 3

Having display: none on an element still makes it applicable to this rule

<div id="my-div" style="display:none">This is my first element</div>
<svg id="my-div">This is my second element</svg>

Inapplicable

Inapplicable Example 1

No id on element

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

Inapplicable Example 2

XML id not applicable to this rule

<div xml:id="my-div">This is my first element</div>

Glossary

Included in the accessibility tree

key: included-in-the-accessibility-tree

Elements included in the accessibility tree of platform specific accessibility APIs. Elements in the accessibility tree are exposed to assistive technologies, allowing users to interact with the elements in a way that meet the requirements of the individual user.

The general rules for when elements are included in the accessibility tree are defined in the core accessibility API mappings. For native markup languages, such as HTML and SVG, additional rules for when elements are included in the accessibility tree can be found in the HTML accessibility API mappings (work in progress) and the SVG accessibility API mappings (work in progress).

Note: Users of assistive technologies might still be able to interact with elements that are not included in the accessibility tree. An example of this is a focusable element with an aria-hidden attribute with a value of true. Such an element could still be interacted with using sequential keyboard navigation regardless of the assistive technologies used, even though the element would not be included in the accessibility tree.

Outcome

key: outcome

A conclusion that comes from evaluating an ACT Rule on a test subject or one of its constituent test target. An outcome can be one of the three following types:

  • Inapplicable: No part of the test subject matches the applicability
  • Passed: A test target meets all expectations
  • Failed: A test target does not meet all expectations

Note: A rule has one passed or failed outcome for every test target. When there are no test targets the rule has one inapplicable outcome. This means that each test subject will have one or more outcomes.

Note: Implementers using the EARL10-Schema can express the outcome with the outcome property. In addition to passed, failed and inapplicable, EARL 1.0 also defined an incomplete outcome. While this cannot be the outcome of an ACT Rule when applied in its entirety, it often happens that rules are only partially evaluated. For example, when applicability was automated, but the expectations have to be evaluated manually. Such "interim" results can be expressed with the incomplete outcome.

Visible

key: visible

Content perceivable through sight.

Content is considered visible if making it fully transparent would result in a difference in the pixels rendered for any part of the document that is currently within the viewport or can be brought into the viewport via scrolling.

Content is defined in WCAG.


Changelog

Aug 21, 2019fix: update links to WCAG21 resources (#776)
Aug 21, 2019Editorial changes (#725)
Jul 22, 2019Replace useless visible-on-the-page with visible (#694)
May 29, 2019chore: add missing contributors (#572)
May 9, 2019Chore: Adapt site to ACT Rules CR format (#547)
May 8, 2019chore: fix invalid frontmatter in updated templates (#544)
May 7, 2019Template update - Id attribute is unique (#529)
Apr 29, 2019chore: rename files and update associations (#489)
Apr 16, 2019chore: add unique id to all rules (#478)
Apr 15, 2019chore: WCAG ACT RULES CG Website Update (#437)
Mar 12, 2019Update SC4-1-1-unique-id.md
Mar 8, 2019fix: update applicability
Jan 18, 2019fix: applicability
Oct 30, 2018Update SC4-1-1-unique-id with missing information (#285)
Oct 29, 2018chore: change references to included in accessibility tree (#322)
Sep 27, 2018Update SC4-1-1-unique-id (#256)
Sep 20, 2018fix: tests cases
Aug 30, 2018Chore: Update test cases format and descriptions (#230)
Jul 13, 2018fix: links in background were not anchors (#187)
Jun 24, 2018FINAL: SC4-1-1-unique-id (#134)
May 14, 2018Draft: SC4-1-1-unique-id (#110)

Useful Links


Implementations

Tool NameCreated ByReport
AlfaSiteimproveView Report
Axe-coreDeque SystemsView Report

Acknowledgements