Skip to content

a11y/color-contrast: reports a class-name guess with no measured ratio on a high-contrast element #465

Closed

Description

@deniskern

Summary

a11y/color-contrast emits a warning from a class-name guess without measuring any contrast ratio. Here class="text-gray-300" on a near-black background defined in an external stylesheet (actual ratio above 12:1) produces "may have low contrast". Measured items carry a ratio (e.g. #999 on #fff (2.85:1)), the guessed ones do not. axe-core reports undeterminable contrast as "incomplete" (needs review), not as a violation.

Repro page

<!doctype html><html lang="en"><head><meta charset="utf-8"><title>color-contrast repro page</title><meta name="description" content="Minimal repro: light text on a dark background defined in external CSS."><link rel="stylesheet" href="s.css"></head><body><main><h1>Repro</h1>
<section class="hero"><p class="text-gray-300">Gray 300 text on a near-black background (contrast above 12:1)</p></section>
</main></body></html>

s.css:

.hero{background:#111}.text-gray-300{color:#d1d5db}
python3 -m http.server 8765
squirrel audit http://localhost:8765/ --http -f json

Actual

a11y/color-contrast (warn): "1 potential color contrast issue(s)", item p with class "text-gray-300..." may have low contrast (no ratio).

Expected

No finding. Only report an element when a contrast ratio was computed and is below the threshold; an unresolvable colour pair should be skipped or marked as needs-review.

Versions

squirrel 0.0.103, macOS, --http.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions