Skip to content
SilktideHelp

Missing anchor

Silktide tests links that point to a specific part of the same page - such as #content - and reports the ones whose target does not exist. Clicking such a link silently does nothing, leaving the user where they were.

<!-- Broken: nothing on the page has id="content" -->
<a href="#content">Skip to content</a>

<!-- Fixed: the target exists -->
<a href="#content">Skip to content</a>
...
<main id="content">...</main>

Why this matters

Links to missing anchors fail silently: there is no error page, the page just does not move. For sighted users this is confusing; for and keyboard users it is worse, because these in-page links are often the very mechanisms - like "skip to content" or a table of contents - that make a long page navigable. A broken anchor quietly removes that shortcut.

How to fix it

  1. Add the missing target: give the intended element an id matching the link's fragment, for example <section id="pricing"> for a link to #pricing.
  2. Or correct the link if the target exists under a different id - fragments are case-sensitive, so #Pricing does not match id="pricing".
  3. If the link only exists to trigger , still point its fragment at the real element's id. The link then keeps its meaning without JavaScript; you may need to prevent the default scroll in your script.
<!-- The fragment matches the element the script reveals -->
<a href="#details" onclick="toggle('details')">Show details</a>
<div id="details">...</div>

How Silktide tests this

  1. Find every link on the page whose destination includes a fragment (the part after #).
  2. Keep only links that point at the current page - either purely #fragment links or full URLs to the same page. Links to anchors on other pages are not tested by this check.
  3. Look for an element whose id matches the fragment, or a legacy <a name="..."> anchor with a matching name.
  4. Flag the link if neither exists.

Learn more

Last updated

Was this page helpful?