Skip to content

fix(cli): skip contrast for intentionally covered text#2366

Merged
miguel-heygen merged 1 commit into
mainfrom
fix/contrast-skip-intentional-occlusion
Jul 13, 2026
Merged

fix(cli): skip contrast for intentionally covered text#2366
miguel-heygen merged 1 commit into
mainfrom
fix/contrast-skip-intentional-occlusion

Conversation

@miguel-heygen

Copy link
Copy Markdown
Collaborator

Summary

  • Skip contrast candidates that explicitly allow occlusion while they are fully covered.
  • Continue auditing the same text whenever any probe point is visible.
  • Add regression coverage for both covered and visible states.

Root Cause

Contrast ignored the layout occlusion contract

Error: Fully covered copy marked data-layout-allow-occlusion produced repeated contrast_aa_failure findings.

Mechanism: The layout audit honors the explicit occlusion opt-out, but the contrast candidate walk only excluded data-layout-ignore, clipped-away, off-canvas, and hidden text. It therefore sampled the covering scene as the hidden text's background and reported meaningless low ratios.

Fix: Reuse the existing hit-test probe grid when an element or ancestor carries data-layout-allow-occlusion. Skip the candidate only when every probe point is covered; visible text still enters the contrast audit.

Changes

  • packages/cli/src/commands/contrast-audit.browser.js: exclude fully covered intentional-occlusion candidates.
  • packages/cli/src/commands/layout-audit.browser.test.ts: cover fully occluded and still-visible opt-out states.

Test Plan

  • Exact 0.7.56 reproduction: layout passed while contrast emitted five false failures for fully covered text.
  • Focused browser audit tests: 49 passed.
  • Lint and format hooks passed.
  • Workspace typecheck hook passed after generating the expected runtime artifact.

Confidence Score: 9/10

The fix is limited to the explicit data-layout-allow-occlusion contract and regression-tests both branches. CI remains the final cross-platform validation.

Source report: https://heygen.slack.com/archives/C0BGC335AQY/p1783980684706089

@miguel-heygen
miguel-heygen merged commit 8e50e84 into main Jul 13, 2026
42 checks passed
@miguel-heygen
miguel-heygen deleted the fix/contrast-skip-intentional-occlusion branch July 13, 2026 22:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant