Skip to content

a11y/identical-links-same-purpose flags mega-menu links whose section context differs #1043

Closed

Description

@deniskern

Summary

a11y/identical-links-same-purpose reports a mega menu that repeats the same link text under different parent sections. Bademode under Damen goes to /damen/bademode/, Bademode under Herren to /herren/bademode/. Each link sits in a submenu labelled by its section (<ul aria-label="Damen">), so its programmatically determined context differs, which WCAG 2.4.9 / 2.4.4 accept. On a live fashion shop this fires on 60 of 60 pages (29–40 link texts per page), since the menu is on every page; we keep the rule disabled.

Repro

<!doctype html><html lang="de"><head><meta charset="utf-8"><title>Shop</title></head><body>
<nav aria-label="Hauptmenü"><ul>
  <li><a href="/damen/">Damen</a><ul aria-label="Damen"><li><a href="/damen/bademode/">Bademode</a></li><li><a href="/damen/shirts/">Shirts</a></li></ul></li>
  <li><a href="/herren/">Herren</a><ul aria-label="Herren"><li><a href="/herren/bademode/">Bademode</a></li><li><a href="/herren/shirts/">Shirts</a></li></ul></li>
</ul></nav>
<main><h1>Shop</h1></main></body></html>
squirrel audit http://127.0.0.1:8765/ --http -m 10 -f json

with [rules] enable = ["*"].

Actual

a11y/identical-links-same-purpose warn: "2 link text(s) lead to different destinations": "bademode" → 2 different URLs, "shirts" → 2 different URLs.

Expected

Links whose programmatic context differs are not grouped as identical: a link inside a list or region with an accessible name (aria-label, aria-labelledby, or a parent list item whose first link names the section) gets that name as context. Equal text with equal context leading to different URLs is still reported. axe treats this rule as "needs review"; a <check>-unconfirmed row would also work if the context cannot be settled.

Version

squirrel v0.0.129

Acceptance Criteria

  • The repro above reports no identical-links-same-purpose finding for Bademode / Shirts
  • Two links with the same text, no distinguishing context and different targets on one page are still reported
  • Context from aria-label, aria-labelledby and a parent <li>'s leading link is covered by tests

Activity

  1. WilliamK112 commented on Oct 26, 2026

    @WilliamK112
    Contributor

    I would like to take this. I will make identical-link grouping include the nearest programmatic section context from aria-label, aria-labelledby, or a parent list item’s leading link, while preserving warnings for equal text and equal context that point to different targets. I will cover the mega-menu repro and each accepted context source with focused tests, then update the rule docs and changelog.

  2. added
    bug
    rules
    size: S
    on Oct 26, 2026
  3. nc9 commented on Oct 26, 2026

    @nc9
    Contributor

    Fixed in #1134 (thank you @WilliamK112): identical link text is grouped by its nearest programmatic section context (aria-labelledby, aria-label, or a parent list item's leading link), so a labelled mega-menu no longer warns while repeated text in the same or no context still does. Ships in v0.0.137.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugrulessize: S

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions