Themes: Support :focus-visible in theme.json.

Add the `:focus-visible` pseudo selector as a valid element in the `theme.json` schema. See also https://github.com/WordPress/gutenberg/pull/68521.

Props huubl, audrasjb, poena, sabernhardt, afercia, annebovelett. 
Fixes #62906.

git-svn-id: https://develop.svn.wordpress.org/trunk@59854 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Joe Dolson 2025-02-21 16:46:34 +00:00
parent 1d77cfa438
commit b8f28f9ade

View File

@ -578,7 +578,7 @@ class WP_Theme_JSON {
/**
* Defines which pseudo selectors are enabled for which elements.
*
* The order of the selectors should be: link, any-link, visited, hover, focus, active.
* The order of the selectors should be: link, any-link, visited, hover, focus, focus-visible, active.
* This is to ensure the user action (hover, focus and active) styles have a higher
* specificity than the visited styles, which in turn have a higher specificity than
* the unvisited styles.
@ -588,11 +588,12 @@ class WP_Theme_JSON {
*
* @since 6.1.0
* @since 6.2.0 Added support for ':link' and ':any-link'.
* @since 6.8.0 Added support for ':focus-visible'.
* @var array
*/
const VALID_ELEMENT_PSEUDO_SELECTORS = array(
'link' => array( ':link', ':any-link', ':visited', ':hover', ':focus', ':active' ),
'button' => array( ':link', ':any-link', ':visited', ':hover', ':focus', ':active' ),
'link' => array( ':link', ':any-link', ':visited', ':hover', ':focus', ':focus-visible', ':active' ),
'button' => array( ':link', ':any-link', ':visited', ':hover', ':focus', ':focus-visible', ':active' ),
);
/**