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
This commit is contained in:
joedolson
2025-03-19 18:46:29 +00:00
parent 3cc90101d3
commit 31c2c95700
2 changed files with 6 additions and 2 deletions

View File

@@ -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;
}
)
);

View File

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