Duplicate IDs
Silktide finds pages where the same id value is used on more than one
element. IDs must be unique within a page, because anything that refers to an
ID - form labels, ARIA relationships, in-page links - can only find one of the
duplicates.
<!-- Both inputs share id="name": which field does each label describe? -->
<label for="name">Your name</label>
<input id="name">
<label for="name">Company name</label>
<input id="name">
Why this matters
depends on ID references to connect related elements.
When IDs are duplicated, a
may read the wrong label for a form field, or no label at all - in the example
above, both fields may announce as "Your name", so the user types their name
into the company box. The same failure affects
attributes like aria-labelledby and aria-describedby, and in-page links
that jump to an #id.
How to fix it
- Rename the duplicates so every
idon the page is unique, and update anything that referenced them (forattributes, ARIA attributes, links). - If the duplicates come from a repeated component - a template stamped out several times per page - fix the template to generate unique IDs, or use classes instead of IDs for styling hooks that don't need referencing.
- If a flagged duplicate is genuinely harmless in your context, you can ignore the finding.
How Silktide tests this
- Find every element on the page with an
idattribute. Elements inside SVG graphics are skipped, as their IDs live in a separate context. - Group elements by their
idvalue. - When more than one element shares the same
id, flag each of them.