fix(cli): skip contrast for intentionally covered text#2366
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Root Cause
Contrast ignored the layout occlusion contract
Error: Fully covered copy marked
data-layout-allow-occlusionproduced repeatedcontrast_aa_failurefindings.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
Confidence Score: 9/10
The fix is limited to the explicit
data-layout-allow-occlusioncontract and regression-tests both branches. CI remains the final cross-platform validation.Source report: https://heygen.slack.com/archives/C0BGC335AQY/p1783980684706089