From 31c2c95700f9f03a45f7db7605e56fe42720d3a6 Mon Sep 17 00:00:00 2001 From: joedolson Date: Wed, 19 Mar 2025 18:46:29 +0000 Subject: [PATCH] Themes: A11y: Merge omitted changes to support `focus-visible`. Merge PHP changes to ensure that `focus` doesn't match `focus-visible` in `WP_Theme_JSON`, overlooked in previous merge. Follow up to [59854]. Props huubl, joemcgill, joedolson. Fixes #62906. Built from https://develop.svn.wordpress.org/trunk@60055 git-svn-id: http://core.svn.wordpress.org/trunk@59391 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/class-wp-theme-json.php | 6 +++++- wp-includes/version.php | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/wp-includes/class-wp-theme-json.php b/wp-includes/class-wp-theme-json.php index cf8b7961e5..f3f015ccd3 100644 --- a/wp-includes/class-wp-theme-json.php +++ b/wp-includes/class-wp-theme-json.php @@ -2906,7 +2906,11 @@ class WP_Theme_JSON { array_filter( $element_pseudo_allowed, static function ( $pseudo_selector ) use ( $selector ) { - return str_contains( $selector, $pseudo_selector ); + /* + * Check if the pseudo selector is in the current selector, + * ensuring it is not followed by a dash (e.g., :focus should not match :focus-visible). + */ + return preg_match( '/' . preg_quote( $pseudo_selector, '/' ) . '(?!-)/', $selector ) === 1; } ) ); diff --git a/wp-includes/version.php b/wp-includes/version.php index fb48bcf1bc..31a9e87748 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.8-beta3-60054'; +$wp_version = '6.8-beta3-60055'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.