Skip to main content

ID Attribute Value Should Be Unique

Best practice is that no more than one element with the same id in an HTML document.

IDs within HTML elements can be used as anchors for navigating through content. IDs can also be utilized to trigger JavaScript actions. IDs are intended to be unique elements, where a specific ID is used only once on a single webpage.

Utilizing the same ID more than once on a page can cause confusion and unexpected behavior if that ID is referenced by an internal link within the page or JavaScript that is supposed to trigger an action. Users may be taken randomly to one area of the page when the intent was the second area with that ID.

Aria-labelledby also allows users to specify an ID within a page for applying labels to elements of a page. If aria-labelledby references an ID that is included in the webpage more than once, the resulting label may not be the intended label because it will be up to the browser which one is used to populate the label.

Duplicate IDs are no longer a WCAG 2.2 failure on their own, since 4.1.1 Parsing was removed, but they still break labels and in-page links, so DubBot reports them as a best practice.

If you have questions, please contact our DubBot Support team via email at help@dubbot.com or via the blue chat bubble in the lower right corner of your screen. We are here to help!

Did this answer your question?