Repository navigation
Contrast checker: Check the visible colour of text clipped to its background - #86148
Conversation
🤖 PR meta 🤖🎉 PropsIf you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. Props Bot commandsYou can trigger Props Bot actions by commenting on this PR:
Updated as activity occurs, without notifying anyone named here. Add the 📦 Bundle sizeSize Change: +344 B (0%) Total Size: 8.58 MB 📦 View Changed
⚡ PerformanceShow the resultsClient side metrics exclude the server response time. front-end-block-theme
front-end-classic-theme
media-processing
media-upload
post-editor
site-editor
🏁 Flaky testsSome tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information. Page List converts to Navigation Links with entity bindings in
|
7efdc3e to
ac6a493
Compare
…ground When a block clips its background to the text, the checker compared the text colour with that clipped background, so it warned or passed on the wrong pair. Read the text's computed fill instead. A transparent fill shows the clipped background: a solid colour as is, a gradient by its lowest contrast opaque stop, and an image is skipped. Find the backdrop by walking up past backgrounds clipped to text. The Typography panel now checks a text gradient and shows its warning on the Gradient control.
The low contrast icon on a gradient control opens a popover that never showed the warning text, since the notice only rendered for colours. Render it after the gradient picker too, so the text gradient warning is readable where it is fixed.
Covers solid and gradient backgrounds clipped to the text, an ancestor's clip, a fill given back, images, translucent stops and links.
The Gradient control does not depend on the text color setting, so its check should not either.
18730ed to
9a0abc6
Compare
When no ancestor clips its background to the text, report the transparent fill instead of nothing, so the transparency warning still shows.
|
FYI, the new |
throwing some tokens at it now |
The test now waits for the popover to finish opening |


Related:
What?
Makes the contrast checker compare the colour readers see when a block's background is clipped to its text.
Why?
With the background clipped to the text, the glyphs show that background, not the text colour. The checker still compared the two. So it warned on readable text, passed unreadable links, and never checked text gradients.
How?
-webkit-text-fill-color. Transparent means the clipped background shows.As on trunk, a Global Styles text gradient alone gets no check. The worst stop can over-warn when it sits off the text.
Testing Instructions
#333333link colour. This PR warns on Link, trunk doesn't.Testing Instructions for Keyboard
Select the step 2 Heading, Tab to Typography > Gradient and press Enter. The notice shows below the picker.
Screenshots or screencast
Use of AI Tools
Written with Claude Code. I reviewed the code, tests and description.