Skip to content

Editor: Support the current state for Navigation Submenu in theme.json - #14284

Closed
MaggieCabrera wants to merge 1 commit into
WordPress:trunkfrom
MaggieCabrera:backport/76367
Closed

MaggieCabrera wants to merge 1 commit into
WordPress:trunkfrom
MaggieCabrera:backport/76367

Conversation

@MaggieCabrera

Copy link
Copy Markdown

Backports the WP_Theme_JSON changes from Gutenberg #76367, a follow-up to #11174 ([62641]).

Themes can style the current link inside a Navigation Submenu dropdown with -current on core/navigation-submenu in theme.json, including its :hover, :focus, :focus-visible and :active states.

The block's selectors.states selector arrives with the Gutenberg package sync, so the new test uses get_styles_for_block() with explicit style nodes, like the existing custom state tests.

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

Testing

  • vendor/bin/phpcs src/wp-includes/class-wp-theme-json.php tests/phpunit/tests/theme/wpThemeJson.php
  • test_block_custom_states_navigation_submenu covers -current and -current with :hover. It fails without the constant changes.

Use of AI Tools

AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Opus 5.5
Used for: Translating the Gutenberg changes to their WordPress Core counterparts, adding a test, 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.

Adds `core/navigation-submenu` to `VALID_BLOCK_PSEUDO_SELECTORS` and
`VALID_BLOCK_CUSTOM_STATES`, so themes can style the current link inside
a submenu dropdown with `-current`, including its pseudo-selector states.

Backports WordPress/gutenberg#76367.

See #66312.

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

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.

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

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

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

LGTM

wporg-sync pushed a commit that referenced this pull request Oct 20, 2026
…on`.

This changeset backports the `WP_Theme_JSON` changes from GB76367, and is a follow-up to #64806.

Themes can style the current link inside a Navigation Submenu dropdown with `-current` on `core/navigation-submenu` in `theme.json`, including its `:hover`, `:focus`, `:focus-visible` and `:active states`.

The block's `selectors.states` selector arrives with the Gutenberg package sync, so the new test uses `get_styles_for_block()` with explicit style nodes, like the existing custom state tests.

Developed in: 
- #14284
- WordPress/gutenberg#76367

Follow-up to #62641.

Props onemaggie.
Fixes #66312.
See #64806.



git-svn-id: https://develop.svn.wordpress.org/trunk@64600 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: 64600
GitHub commit: 43f60f4

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
…on`.

This changeset backports the `WP_Theme_JSON` changes from GB76367, and is a follow-up to #64806.

Themes can style the current link inside a Navigation Submenu dropdown with `-current` on `core/navigation-submenu` in `theme.json`, including its `:hover`, `:focus`, `:focus-visible` and `:active states`.

The block's `selectors.states` selector arrives with the Gutenberg package sync, so the new test uses `get_styles_for_block()` with explicit style nodes, like the existing custom state tests.

Developed in: 
- WordPress/wordpress-develop#14284
- WordPress/gutenberg#76367

Follow-up to #62641.

Props onemaggie.
Fixes #66312.
See #64806.


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


git-svn-id: http://core.svn.wordpress.org/trunk@63750 1a063a9b-81f0-0310-95a4-ce76da25c4cd
@MaggieCabrera

MaggieCabrera commented Oct 20, 2026 •

Copy link
Copy Markdown
Author

hey @audrasjb did you commit this to core? the GB PR didn't make it in. It had some feedback that I couldn't address in time for the release. I'm happy to try and bring it in for beta 2 though!

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