Skip to content

Editor: Add pseudo-selector support for text inputs (backport GB #71634) - #13056

Closed
MaggieCabrera wants to merge 5 commits into
WordPress:trunkfrom
MaggieCabrera:codex/backport-71634-text-input-pseudo-selectors
Closed

MaggieCabrera wants to merge 5 commits into
WordPress:trunkfrom
MaggieCabrera:codex/backport-71634-text-input-pseudo-selectors

Conversation

@MaggieCabrera

@MaggieCabrera MaggieCabrera commented Aug 14, 2026 •

Copy link
Copy Markdown

Backports the WP_Theme_JSON changes from Gutenberg PR #71634.

This adds :required, :user-valid, :user-invalid, :focus, :focus-visible, and ::placeholder support for the textInput element. Pseudo-elements are output without the :where() wrapper because pseudo-elements are not valid inside it.

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

Testing

  • php -l src/wp-includes/class-wp-theme-json.php tests/phpunit/tests/theme/wpThemeJson.php
  • vendor/bin/phpcs src/wp-includes/class-wp-theme-json.php tests/phpunit/tests/theme/wpThemeJson.php
  • The text_input tests in wpThemeJson.php cover the text input states.

Use of AI Tools

AI assistance: Yes
Tool(s): OpenAI Codex, Claude Code
Model(s): GPT-5, Claude Opus 5.5
Used for: Translating the Gutenberg changes to their WordPress Core counterparts, adding tests, running validation, and drafting the pull request.


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.

@github-actions

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.

Backports the select element changes from Gutenberg PR #81644.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@MaggieCabrera MaggieCabrera changed the title Editor: Add pseudo-selector support for text inputs (backport GB #71634) Editor: Add pseudo-selector support for text inputs and select elements (backport GB #71634, #81644) Oct 14, 2026
MaggieCabrera and others added 2 commits October 19, 2026 19:18
…tors.

Syncs the text input changes with Gutenberg PR #71634. `:valid` and `:invalid` are replaced by `:user-valid` and `:user-invalid`, which only match after a visitor interacts with the field. Pseudo-element rules such as `::placeholder` are now output as `:root :where(base)::placeholder`, so they get the same specificity at the element, block and block style variation levels.

Adds tests for the text input states, their cascade order, block-level and variation `::placeholder` styles, and sanitization.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ate.

Splits the 7.2.0 `@since` entry so it lists the states added for the select and text input elements, and extends the select tests to cover `:focus`, `:active` and a block-level select in the Categories block.

Follow-up to review feedback on WordPress/gutenberg#81644.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@audrasjb

Copy link
Copy Markdown
Contributor

Is this still a draft?
As it is an enhancement, it should be committed today, or moved to WP 7.3 @MaggieCabrera

Keeps the text input and select changes in separate commits so either can be reverted on its own.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@MaggieCabrera MaggieCabrera changed the title Editor: Add pseudo-selector support for text inputs and select elements (backport GB #71634, #81644) Editor: Add pseudo-selector support for text inputs (backport GB #71634) Oct 20, 2026
@MaggieCabrera
MaggieCabrera marked this pull request as ready for review October 20, 2026 10:56
@github-actions

github-actions Bot commented Oct 20, 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 onemaggie, mikachan, audrasjb, mamaduka.

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

@Mamaduka

Copy link
Copy Markdown
Member

I see that WordPress/gutenberg#71634 was also merged. Seems we want to land this in 7.2.

@audrasjb, do you have bandwidth to do a technical review?

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

This reads well to me and the logic is the same as WordPress/gutenberg#71634. I think it's ready to bring in since WordPress/gutenberg#71634 has merged.

@Mamaduka

Copy link
Copy Markdown
Member

I've backported the Gutenberg merge to the wp/7.2 branch. @MaggieCabrera, @mikachan, can you commit this to trunk?

@MaggieCabrera

Copy link
Copy Markdown
Author

I see that WordPress/gutenberg#71634 was also merged. Seems we want to land this in 7.2.

@audrasjb, do you have bandwidth to do a technical review?

hi, yes, please, and thank you all for your time in this busy day. This and #14544 I would like to bring both in for 7.2. For that one I'm waiting on the GB tests to pass, it's already approved and set to auto merge. Your call if you feel like it's too late to put them in.

@mikachan

Copy link
Copy Markdown
Member

I can commit this to trunk, working on it now. Thanks @Mamaduka!

wporg-sync pushed a commit that referenced this pull request Oct 20, 2026
Adds `:required`, `:user-valid`, `:user-invalid`, `:focus`, `:focus-visible`, and `::placeholder` to the pseudo selectors that `WP_Theme_JSON` allows for the `textInput` element, so themes can style these states in `theme.json`.

Developed in #13056.
Discussed in WordPress/gutenberg#71634.

Props onemaggie, scruffian, sarthaknagoshe2002, wildworks, im3dabasia1, audrasjb, mamaduka.
Fixes #65880.

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

Copy link
Copy Markdown

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

SVN changeset: 64597
GitHub commit: 147200e

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 Oct 20, 2026
wporg-sync pushed a commit to WordPress/WordPress that referenced this pull request Oct 20, 2026
Adds `:required`, `:user-valid`, `:user-invalid`, `:focus`, `:focus-visible`, and `::placeholder` to the pseudo selectors that `WP_Theme_JSON` allows for the `textInput` element, so themes can style these states in `theme.json`.

Developed in WordPress/wordpress-develop#13056.
Discussed in WordPress/gutenberg#71634.

Props onemaggie, scruffian, sarthaknagoshe2002, wildworks, im3dabasia1, audrasjb, mamaduka.
Fixes #65880.
Built from https://develop.svn.wordpress.org/trunk@64597


git-svn-id: http://core.svn.wordpress.org/trunk@63747 1a063a9b-81f0-0310-95a4-ce76da25c4cd
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.

4 participants