Commit f870f114f5 for wordpress.org
commit f870f114f59fea110af2032943dea23618d5ece2
Author: audrasjb <audrasjb@1a063a9b-81f0-0310-95a4-ce76da25c4cd>
Date: Tue Oct 20 14:19:02 2026 +0000
Editor: Support the current state for Navigation Submenu in `theme.json`.
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:
- https://github.com/WordPress/wordpress-develop/pull/14284
- https://github.com/WordPress/gutenberg/pull/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
diff --git a/wp-includes/class-wp-theme-json.php b/wp-includes/class-wp-theme-json.php
index dc7862aa24..df3af740d6 100644
--- a/wp-includes/class-wp-theme-json.php
+++ b/wp-includes/class-wp-theme-json.php
@@ -685,11 +685,13 @@ class WP_Theme_JSON {
* The valid pseudo-selectors that can be used for blocks.
*
* @since 7.0
+ * @since 7.2.0 Added `core/navigation-submenu`.
* @var array
*/
const VALID_BLOCK_PSEUDO_SELECTORS = array(
- 'core/button' => array( ':hover', ':focus', ':focus-visible', ':active' ),
- 'core/navigation-link' => array( ':hover', ':focus', ':focus-visible', ':active' ),
+ 'core/button' => array( ':hover', ':focus', ':focus-visible', ':active' ),
+ 'core/navigation-link' => array( ':hover', ':focus', ':focus-visible', ':active' ),
+ 'core/navigation-submenu' => array( ':hover', ':focus', ':focus-visible', ':active' ),
);
/**
@@ -708,10 +710,12 @@ class WP_Theme_JSON {
* `.wp-block-navigation-item.current-menu-item:hover`.
*
* @since 7.1.0
+ * @since 7.2.0 Added `core/navigation-submenu`.
* @var array
*/
const VALID_BLOCK_CUSTOM_STATES = array(
- 'core/navigation-link' => array( '-current' ),
+ 'core/navigation-link' => array( '-current' ),
+ 'core/navigation-submenu' => array( '-current' ),
);
/**
diff --git a/wp-includes/version.php b/wp-includes/version.php
index 303f670488..3fc4d406c5 100644
--- a/wp-includes/version.php
+++ b/wp-includes/version.php
@@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
-$wp_version = '7.2-alpha-64599';
+$wp_version = '7.2-alpha-64600';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.