Skip to content

a11y/image-redundant-alt: descriptive logo alt reported redundant when it matches a readable filename #1273

Closed

Description

@deniskern

Summary

a11y/image-redundant-alt reports alt="Google Partner Logo" as redundant solely because the image filename is google-partner-logo.svg. The alt identifies the logo correctly; the filename being equally descriptive does not make it redundant for a screen-reader user. There is no adjacent text repeating this alt in the repro.

Minimal repro

Serve this page and a small valid SVG with a local node:http server:

<!doctype html><html lang="en"><head><meta charset="utf-8">
<title>Descriptive partner logo alt fixture</title></head><body><main>
<h1>Certifications</h1>
<img src="google-partner-logo.svg" alt="Google Partner Logo">
</main></body></html>
squirrel audit http://127.0.0.1:8765/logo --http --offline --no-publish --refresh -C full -m 20 -f json -o out.json

Actual

{"ruleId":"a11y/image-redundant-alt","name":"image-redundant-alt","status":"warn","message":"1 image(s) with redundant alt text","items":[{"id":"alt=\"Google Partner Logo\" matches filename"}]}

Expected

No warning for this descriptive alt. Filename equality after removing spaces/hyphens is insufficient evidence of redundancy. Preserve warnings for filename-like slugs and genuine adjacent-text duplication.

Controls (same versions)

Markup Result
<img src="google-partner-logo.svg" alt="Google Partner Logo"> warn — false positive
<img src="arrow-downwards.svg" alt="arrow-downwards"> warn — expected
<figure><img src="brand.svg" alt="Partner certification"><figcaption>Partner certification</figcaption></figure> warn — expected
<img src="brand.svg" alt="Google Partner certification"> no warning — expected

An alt equal to an arbitrary adjacent span was not flagged in our larger main/nav wrapper; the figcaption control above is the verified adjacent-text positive case.

Version

squirrel 0.0.138 and 0.0.139, Linux arm64, HTTP/offline mode. Reproduced using Overhub's global template; the target rule is enabled and unmodified.

Triage

v0.0.138 packages/rules/src/a11y/image-redundant-alt.ts normalizes both alt and filename with .toLowerCase().replace(/[-_\s]+/g, ""), then reports equality. This turns a human-readable label into a filename match. The filename branch needs to distinguish a readable description from a raw filename/slug; surrounding-text checks should remain separate.

Acceptance Criteria

  • The Google Partner Logo fixture produces no image-redundant-alt warning.
  • The arrow-downwards slug control still warns.
  • The matching figcaption control still warns.
  • The distinct descriptive-alt control still passes.
  • Regression tests cover readable alt/filename equality without weakening the existing redundant-prefix and surrounding-text checks.

Activity

  1. added
    bug
    rules
    size: XS
    on Oct 29, 2026
  2. nc9 commented on Oct 29, 2026

    @nc9
    Contributor

    Thanks @deniskern, confirmed on current main. image-redundant-alt strips spaces, hyphens and underscores from both the alt and the filename and flags any match, so a readable label like "Google Partner Logo" reads the same as the slug google-partner-logo. A fix should only flag an alt that looks like a raw slug (no spaces, or the filename verbatim), keeping your controls as the tests. Your acceptance criteria are the spec; queued.

  3. added theissue type on Oct 29, 2026
  4. nc9 commented on Oct 30, 2026

    @nc9
    Contributor

    Fixed in v0.0.142 (1ea94aae), via the stacked release PR #1331.

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: XS

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions