Skip to content

Global styles: Fix pseudo element output - #12918

Closed
talldan wants to merge 3 commits into
WordPress:trunkfrom
talldan:fix/phantom-pseudo-style-output
Closed

Global styles: Fix pseudo element output#12918
talldan wants to merge 3 commits into
WordPress:trunkfrom
talldan:fix/phantom-pseudo-style-output

Conversation

@talldan

@talldan talldan commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Backports WordPress/gutenberg#81265 & WordPress/gutenberg#81291

Fixes theme.json output issues for pseudo styles.

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

Use of AI Tools

AI assistance: Yes
Tool(s): OpenCode
Model(s): Kimi K3
Used for: Writing Code


This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.

@talldan talldan self-assigned this Aug 6, 2026
@talldan talldan added the bug label Aug 6, 2026
@talldan talldan changed the title Backport gutenberg changes Global styles: Fix pseudo element output Aug 6, 2026
@ramonjd

ramonjd commented Aug 7, 2026

Copy link
Copy Markdown
Member

Checked fidelity of WordPress/gutenberg#81265 sync. 👍🏻 Just kicking off tests again - locally there's a failing test for me, going to double check

Next I'll merge WordPress/gutenberg#81265, then rebase/review WordPress/gutenberg#81291.

Cheers!

@github-actions

github-actions Bot commented Aug 7, 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. You can also manually ask me to refresh this list by adding the props-bot label.

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

Props talldanwp, ramonopoly, isabel_brison.

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

Comment thread tests/phpunit/tests/theme/wpThemeJson.php Outdated
…g output.

The :hover pseudo-class belongs inside the :root :where() wrapper,
which is what get_stylesheet() outputs and what the Gutenberg source
PRs' tests expect. Outside the wrapper the rule would also gain 0-1-0
specificity, which the :where() wrap exists to avoid.
@github-actions

github-actions Bot commented Aug 7, 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.

@tellthemachines tellthemachines left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

looks like static analysis needs fixing, but other than that the code changes LGTM!

@ramonjd

ramonjd commented Aug 7, 2026

Copy link
Copy Markdown
Member

looks like static analysis needs fixing, but other than that the code changes LGTM!

Working on that now. Thanks for the quick review.

I'm using the dev-feedback and dev-reviewed labels over in the ticket: https://core.trac.wordpress.org/ticket/65827#comment:5 for releases to trunk (assuming this is the review and I add the "reviewed" label) 😄

See: https://wordpress.slack.com/archives/C02RQBWTW/p1786058089019879

@tellthemachines

Copy link
Copy Markdown
Contributor

I'm using the dev-feedback and dev-reviewed labels over in the ticket

I can never properly remember how that's supposed to work 😅 but yeah all commits need double dev sign-off at this point

@ramonjd

ramonjd commented Aug 7, 2026

Copy link
Copy Markdown
Member

double dev sign-off at this point

Good that @talldan got this started for us two 👍🏻 Thanks for confirming

The suppressed 'If condition is always false' error pointed at the
dead include_node_paths_only branch in get_block_nodes() pseudo
selector handling, which this PR removes. With the code gone the
unmatched baseline entry itself fails analysis because
reportUnmatchedIgnoredErrors is enabled.

@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.

Tested this manually and also compared the GB code. LGTM

pento pushed a commit that referenced this pull request Aug 7, 2026
… remove phantom pseudo element style output

This commit fixes two bugs in the CSS output of global styles under the following conditions:

1. `get_stylesheet()` used to return nothing for a theme.json elements style only inside a breakpoint. It now returns the correct CSS.
2. An incorrect pseudo style would be output whenever a responsive+pseudo style was set for the element (but no pseudo style itself). That incorrect pseudo style has been suppressed.

Developed in: #12918

Reviewed by ramonopoly, isabel_brison.

Props talldanwp, ramonopoly, isabel_brison.

Fixes #65827.



git-svn-id: https://develop.svn.wordpress.org/trunk@63157 602fd350-edb4-49c9-b593-d223f7449a82
@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown

A commit was made that fixes the Trac ticket referenced in the description of this pull request.

SVN changeset: 63157
GitHub commit: f358f5e

This PR will be closed, but please confirm the accuracy of this and reopen if there is more work to be done.

@github-actions github-actions Bot closed this Aug 7, 2026
markjaquith pushed a commit to markjaquith/WordPress that referenced this pull request Aug 7, 2026
… remove phantom pseudo element style output

This commit fixes two bugs in the CSS output of global styles under the following conditions:

1. `get_stylesheet()` used to return nothing for a theme.json elements style only inside a breakpoint. It now returns the correct CSS.
2. An incorrect pseudo style would be output whenever a responsive+pseudo style was set for the element (but no pseudo style itself). That incorrect pseudo style has been suppressed.

Developed in: WordPress/wordpress-develop#12918

Reviewed by ramonopoly, isabel_brison.

Props talldanwp, ramonopoly, isabel_brison.

Fixes #65827.


Built from https://develop.svn.wordpress.org/trunk@63157


git-svn-id: http://core.svn.wordpress.org/trunk@62356 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants