Skip to content

fix(check): mark a contrast finding by its severity and quote its text - #7752

Open
wonjangcloud9 wants to merge 1 commit into
heygen-com:mainfrom
wonjangcloud9:fix/check-contrast-severity-icon
Open

wonjangcloud9 wants to merge 1 commit into
heygen-com:mainfrom
wonjangcloud9:fix/check-contrast-severity-icon

Conversation

@wonjangcloud9

Copy link
Copy Markdown
Contributor

What

check's Contrast section now marks each finding with its own severity (⚠ for a warning, ✗ for an error) and quotes the text it judged.

Why

A long-form video had a number card whose text passed through a low-contrast colour at one sample. check (0.9.43) printed:

Contrast
  ✗ div > div:nth-of-type(35) > div > div:nth-of-type(2) > div:nth-of-type(4) > div:nth-of-type(3) 2.39:1 (need 3:1, t=170.999s)
    Try rgb(219,108,80); source compositions/vs1.html
  0 error(s), 1 warning(s), 0 info(s)

Two things made this hard to act on:

  • The mark is the error ✗, and the count line under it says 0 error(s), 1 warning(s). buildContrastResults demotes a failure seen at a single sample to a warning, but printContrastSection hardcodes c.error("✗"). Every other section goes through findingIcon.
  • The element has no id, so its name is an nth-of-type path. The finding already carries the text (text, capped at 50 characters by the audit), and validate prints it, but check did not.

Related work

How

packages/cli/src/commands/check.ts, printContrastSection: the mark comes from findingIcon(finding), and the line adds the dimmed, quoted finding.text after the selector when there is one. The JSON report is unchanged.

Test plan

Unit (packages/cli/src/commands/check.test.ts): a new case prints a report with one warning and one error contrast finding and expects ⚠ (and no ✗) on the warning's line, ✗ on the error's line, and both lines found by their quoted text. On main (29533f63) with the fix stashed it fails with expected '' to contain '⚠'. With the fix, check.test.ts passes 200 tests. tsc --noEmit, oxlint and oxfmt are clean.

Real CLI on a minimal project (the blank template with a row of two id-less <div>s, the second tweening from #3a3a3a to #ffffff at 2.4 s), hyperframes check --no-cache:

0.9.43
  ✗ div > div > div:nth-of-type(2) 1.85:1 (need 3:1, t=0.556s)
    Try rgb(90,90,90); source index.html
  0 error(s), 1 warning(s), 0 info(s)

this branch
  ⚠ div > div > div:nth-of-type(2) "43만 원" 1.85:1 (need 3:1, t=0.556s)
    Try rgb(90,90,90); source index.html
  0 error(s), 1 warning(s), 0 info(s)

🤖 Generated with Claude Code

@wonjangcloud9

Copy link
Copy Markdown
Contributor Author

The commit here was unsigned, which main does not accept. I rebased onto main (797a622b) and signed it; the new head 7b2d037f shows as Verified and the diff is unchanged. check.test.ts (200 tests), tsc --noEmit for the CLI, oxlint, oxfmt and the comment checks pass on it.

The Contrast section printed every finding with the error mark, so a
failure seen at a single sample (a warning) read as "✗ ... 0 error(s),
1 warning(s)". It now uses the same severity icon as the other sections.

A finding on an element without an id is named by an nth-of-type path,
which does not say which text failed. The line now quotes the text the
audit judged, as `validate` already does.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@wonjangcloud9

wonjangcloud9 commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor Author

Rebased again onto main (6a7b4df7): #7779 changed the same line to pass the selector through terminalText. The line now keeps both, the severity icon and terminalText(finding.selector), and the quoted finding text goes through terminalText as well. The new head 344d3f64 is signed.

On it: check.test.ts (202 tests), tsc --noEmit for the CLI, oxlint, oxfmt and the comment checks pass. A manual hyperframes check on a project with one low-contrast warning prints:

Contrast
  ⚠ #t2 "Net loss" 1.05:1 (need 3:1, t=0.222s)
    Try rgb(95,95,92); source index.html
  0 error(s), 1 warning(s), 0 info(s)

@wonjangcloud9
wonjangcloud9 force-pushed the fix/check-contrast-severity-icon branch from 7b2d037 to 344d3f6 Compare November 15, 2026 09:45

This branch has not been deployed

No deployments
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