squirrelscan
GitHub

Identical link text pointing at different pages

Two links reading 'Learn more' that go to different places are indistinguishable in a screen reader's link list. squirrel finds them.

What the problem is

Screen readers can present every link on a page as a list, sorted and read out of context. In that list two entries reading “Learn more” are the same entry twice, and there is no way to tell which one leads where.

The opposite case is fine and expected: the same text pointing at the same page, in a nav bar and again in the footer, is one destination described consistently.

What squirrel checks

One check, identical-links-same-purpose, at severity warning. It reads every a[href], taking the link’s trimmed and lowercased text along with its href, and skips links with no text, text shorter than two characters, or an href beginning with #.

Destinations are normalized before comparison: the href is lowercased, trailing slashes are stripped and the query string is dropped. So /pricing, /pricing/ and /pricing?ref=nav all count as one destination.

  • Warn when one text maps to more than one destination. Report message: N link text(s) lead to different destinations. Items read "learn more" → 3 different URLs, up to ten with a count of the rest, carrying the suggestion Make link text unique to differentiate destinations.
  • Pass with Identical link texts go to same destinations.
  • Info with No links found.

URLs are compared as written, so a link to /pricing and one to https://example.com/pricing are treated as different destinations even though they resolve to the same page. That is the most common false positive here.

How to fix it

<a href="/plans/team">Learn more about the Team plan</a>
<a href="/plans/enterprise">Learn more about Enterprise</a>

Extend the visible text. Where the design cannot take more words, keep the short label visible and put the full phrase in aria-label, making sure the visible words appear inside it.

Rule IDa11y/identical-links-same-purpose
CategoryAccessibility
ScopePer-page
Severitywarning
Weight4/10

Enable / disable

Disable this rule

[rules]
disable = ["a11y/identical-links-same-purpose"]

Disable all Accessibility rules

[rules]
disable = ["a11y/*"]

Enable only this rule

[rules]
enable = ["a11y/identical-links-same-purpose"]

enable replaces the default ["*"], so this is the only rule selected. Leave disable out: a rule that matches any disable pattern is skipped even when enable names it. Only an enabled setting under a rule’s own [rule_options] table overrides both lists.

Accessibility findings ship in every audit next to the SEO, performance and agent experience rules. See Website security scan with AI for how an agent works through a report.

References

Check your site

Run squirrel audit https://example.com and open the Accessibility section of the report. Each repeated phrase is listed with how many destinations it points at. Signed-out local audits need no account and cost nothing. Signed-in audits spend credits.

Type to search…

↑↓ navigate↵ openesc close