Skip to content

fix(cli): check no longer reports text painted by a visible text-shadow as not painted - #8364

Merged
jrusso1020 merged 2 commits into
heygen-com:mainfrom
utsxvrai:fix/check-text-shadow-paints-glyphs
Nov 28, 2026
Merged

jrusso1020 merged 2 commits into
heygen-com:mainfrom
utsxvrai:fix/check-text-shadow-paints-glyphs

Conversation

@utsxvrai

@utsxvrai utsxvrai commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

What

check reported text_not_painted on text with a transparent fill whose glyphs are drawn by a visible text-shadow (e.g. a shadow-offset reveal). A shadow layer with colour alpha above 0.05 now counts as paint, the same way a visible stroke does.

Why

The shadow draws the glyph shapes, so the text is legible, but the rule only looked at fill, stroke and background-clip: text. In the reporter's project this produced 80 false findings for 156 character spans.

Related work

Fixes #8361 (follows the same path as #6693 for -webkit-text-stroke).

How

textShadowPaints() splits the computed text-shadow into layers with the existing splitTopLevelCommas and checks each layer's colour with colorAlpha. invisibleTextIssue calls it right after the stroke check. Transparent text with no shadow, a fully transparent shadow, or a shadow that takes the transparent color is still reported.

Test plan

  • Unit tests added/updated: four rows in the "judges $name by what it paints" table in layout-audit.chromium.test.ts. The two "not flagged" rows fail on main and pass here; the full Chromium file passes, 87 tests.
  • Manual testing performed (local Chrome, macOS)
  • Documentation updated (not applicable)
  • Comments follow CONTRIBUTING.md "Comments"

@jrusso1020 jrusso1020 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed at c126353fa288f2fd73beba83b9c48ea2a16542a7. Approve. Thanks for the fix and the clear test rows!

Need: yes, a shadow-only reveal produced 80 false text_not_painted findings in the reporter's project (#8361) · Size: ok (2 files, +28/-0) · Reuse: reuses splitTopLevelCommas and colorAlpha, and follows the -webkit-text-stroke path from #6693 · Simpler: already minimal · Structure: fine

Risk: low — only narrows when text_not_painted fires, and only when a shadow layer has visible colour

What I checked

  • Computed shape. Chromium serialises text-shadow as rgb(...) Xpx Ypx Bpx layers, so colorAlpha(layer) finds the colour inside each layer string. A shadow with no colour resolves to currentcolor, so with color: transparent it serialises as rgba(0, 0, 0, 0) … and is still flagged. The fourth row covers that.
  • Tests (real Chromium, chrome-headless-shell 155):
    • At the head: layout-audit.chromium.test.ts gives 87 passed.
    • Mutation: with layout-audit.browser.js from the merge-base and the new rows kept, exactly the two "not flagged" rows fail (85 passed, 2 failed), as the test plan says.

Nits (non-blocking)

  1. Non-rgb colours. colorAlpha returns 1 for a colour it can't parse. A shadow written in a colour space Chromium keeps as-is (for example oklch(… / 0)) would count as visible. The stroke check has the same limit today, so this is not new.

— Rames (hf-review)

@jrusso1020
jrusso1020 enabled auto-merge November 21, 2026 16:15
@jrusso1020
jrusso1020 added this pull request to the merge queue Nov 28, 2026
Merged via the queue into heygen-com:main with commit 34a7789 Nov 28, 2026
118 of 164 checks passed
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.

Layout audit flags text painted by a visible text-shadow as text_not_painted

2 participants