Skip to content

Commit dce8fe4

Browse files
committed
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. git-svn-id: https://develop.svn.wordpress.org/trunk@60055 602fd350-edb4-49c9-b593-d223f7449a82
1 parent bd67414 commit dce8fe4

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/wp-includes/class-wp-theme-json.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2906,7 +2906,11 @@ static function ( $split_selector ) use ( $clean_style_variation_selector ) {
29062906
array_filter(
29072907
$element_pseudo_allowed,
29082908
static function ( $pseudo_selector ) use ( $selector ) {
2909-
return str_contains( $selector, $pseudo_selector );
2909+
/*
2910+
* Check if the pseudo selector is in the current selector,
2911+
* ensuring it is not followed by a dash (e.g., :focus should not match :focus-visible).
2912+
*/
2913+
return preg_match( '/' . preg_quote( $pseudo_selector, '/' ) . '(?!-)/', $selector ) === 1;
29102914
}
29112915
)
29122916
);

0 commit comments

Comments
 (0)