Skip to content

a11y/link-text and links/anchor-text only recognise English generic phrases #840

Closed

Description

@nc9

a11y/link-text and links/anchor-text only recognise English generic phrases ("click here", "read more", "learn more", "here", "more"). On a French, German or Spanish site, links reading "cliquez ici", "mehr", "haga clic aqui" or "en savoir plus" are never reported, so the checks silently pass for most of the web.

Change: a per-language generic phrase list, selected from the page's <html lang> primary subtag (English is always checked as well). Keep it conservative: whole-text matches only, and only phrases that are generic in that language. Follows the conventional-label set from the sign in / terms exemption issue, which must win over these lists.

Acceptance Criteria

  • Generic phrases exist for at least Spanish, French, German, Portuguese, Italian, Dutch, Japanese, Chinese, Korean and Russian, chosen by the page language, with English always applied
  • Matching is on the whole normalised link text (NFKC, case folding, trailing and full-width punctuation); CJK text is not split on word boundaries
  • A page with no or an unknown lang is checked with the English list only
  • Conventional account and legal labels are never reported in any language
  • A test per language covers a generic phrase that is reported and a descriptive link that is not
  • docs/rules/a11y/link-text.mdx and docs/rules/links/anchor-text.mdx document the languages, and the CHANGELOG has an entry

Activity

  1. added
    enhancement
    size: M
    rules
    on Oct 15, 2026
  2. nc9 commented on Oct 16, 2026

    @nc9
    ContributorAuthor

    Triage, checked on main d93241c:

    • Still reproduces. Both phrase lists are English only: GENERIC_LINK_TEXT in packages/rules/src/a11y/link-text.ts and GENERIC_ANCHORS in packages/rules/src/links/anchor-text.ts. Neither reads <html lang>. "cliquez ici", "mehr" and "en savoir plus" pass.
    • Ordering dependency: the criteria say the conventional account and legal labels (a11y/link-text flags 'sign in', 'sign up' and other conventional account and legal labels as generic #839) must win over these lists. That set is implemented on the unpushed release branch nc9/link-section-findings (commit 3cc28f66, which touches link-text.ts). Building a11y/link-text and links/anchor-text only recognise English generic phrases #840 on main now would conflict with it in the same two files. Start it once that branch lands, on top of its shared label module.
    • Size M fits: about ten language lists, NFKC and case-fold matching, CJK whole-text matching, a test per language, and docs for both rules.
  3. added a commit that references this issue on Oct 22, 2026
    4dc22a9
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

    enhancementrulessize: M

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions