Skip to content

Global Styles: Put text clip escapes on a block's feature selectors - #15432

Open
aaronrobertshaw wants to merge 3 commits into
WordPress:trunkfrom
aaronrobertshaw:backport/86246-text-clip-feature-selectors
Open

aaronrobertshaw wants to merge 3 commits into
WordPress:trunkfrom
aaronrobertshaw:backport/86246-text-clip-feature-selectors

Conversation

@aaronrobertshaw

@aaronrobertshaw aaronrobertshaw commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Backport of Gutenberg PR WordPress/gutenberg#86246

Trac ticket: https://core.trac.wordpress.org/ticket/66465

Text colours set over a text gradient now show on blocks that style an inner element, like the Search button. This covers colours set at a breakpoint, on :hover and in a block style.

This PR backports:

  • the text clip check reading the theme.json data, not the node that lost its feature styles,
  • the text fill reset going on the block's color feature selector and the clip escape on its background one,
  • and the accompanying WP_Theme_JSON tests.

Note

This PR and #15366 both add the text clip check to a block style's main rule. This PR and #15433 both change the pseudo-state call in process_pseudo_selectors() and its breakpoint variation caller. Whichever merges second needs a small rebase.

Testing instructions

  1. Activate Twenty Twenty-Five.
  2. Add these styles to its theme.json:
"blocks": {
	"core/search": {
		"background": { "gradient": "linear-gradient(120deg,#ff5f6d 0%,#7f00ff 100%)", "backgroundClip": "text" },
		"@mobile": { "color": { "text": "#0b3d91" } }
	}
}
  1. Add a Search block to a page and view it at a mobile width. The button text is blue, not the gradient.
  2. In the page source, the mobile rule for the button now includes the text fill reset:
@media (width <= 480px){:root :where(.wp-block-search .wp-block-search__button, .wp-block-search.wp-block-search__no-button .wp-block-search__input){color: #0b3d91;-webkit-text-fill-color: currentColor;}}

On trunk the same rule has only color: #0b3d91;, so the button text stays transparent and keeps the gradient.

Use of AI

AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Opus 5
Used for: The mechanical port, tests and description; I reviewed and edited them.

The text clip check ran after feature selector extraction had removed a state's color and background styles. So it missed text colors and gradients set at a breakpoint, on :hover or in a block style, and any reset landed on the block's main selector.

The check now reads the theme.json data. The text fill reset goes on the block's color feature selector and the clip escape on its background one, where those styles are output.
@aaronrobertshaw aaronrobertshaw self-assigned this Nov 4, 2026
@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown

Test using WordPress Playground

The changes in this pull request can previewed and tested using a WordPress Playground instance.

WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser.

Some things to be aware of

  • All changes will be lost when closing a tab with a Playground instance.
  • All changes will be lost when refreshing the page.
  • A fresh instance is created each time the link below is clicked.
  • Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance,
    it's possible that the most recent build failed, or has not completed. Check the list of workflow runs to be sure.

For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation.

Test this pull request with WordPress Playground.

@aaronrobertshaw
aaronrobertshaw marked this pull request as ready for review November 5, 2026 09:01
@github-actions

github-actions Bot commented Nov 5, 2026

Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs.

Core Committers: Use this line as a base for the props when committing in SVN:

Props aaronrobertshaw.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.


Props Bot commands

You can trigger Props Bot actions by commenting on this PR:

  • @propsbot add <username> to give props to a GitHub user. Requires write access.
  • @propsbot remove <username> to leave a user out of the props. Requires write access.
  • @propsbot refresh to refresh this list. Adding the props-bot label works too.

@ramonjd ramonjd left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Checked against source PR and it's a faithful backport.

I guess we need to land #15366 before this PR?

Also, I guess it might be wise to hold off committing this until later in the 7.2 cycle to prevent any conflicts with incoming changes/bug fixes for that release.

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.

2 participants