From fb7eb2f59f8a27d0339e8dcc97eed0b4ebc98ea1 Mon Sep 17 00:00:00 2001 From: George Mamadashvili Date: Tue, 8 Nov 2022 21:41:20 +0400 Subject: [PATCH 1/2] Global Styles: Update the order of pseudo selectors --- src/wp-includes/class-wp-theme-json.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/wp-includes/class-wp-theme-json.php b/src/wp-includes/class-wp-theme-json.php index 555898370f863..346634edca0f9 100644 --- a/src/wp-includes/class-wp-theme-json.php +++ b/src/wp-includes/class-wp-theme-json.php @@ -394,13 +394,17 @@ class WP_Theme_JSON { /** * Defines which pseudo selectors are enabled for which elements. * + * The order of the selectors should be: visited, hover, focus, active. + * This is to ensure that 'visited' has the lowest specificity + * and the other selectors can always overwrite it. + * * Note: this will affect both top-level and block-level elements. * * @since 6.1.0 */ const VALID_ELEMENT_PSEUDO_SELECTORS = array( - 'link' => array( ':hover', ':focus', ':active', ':visited' ), - 'button' => array( ':hover', ':focus', ':active', ':visited' ), + 'link' => array( ':visited', ':hover', ':focus', ':active' ), + 'button' => array( ':visited', ':hover', ':focus', ':active' ), ); /** From f542397df999f5aebc12a35358d40299576a6450 Mon Sep 17 00:00:00 2001 From: George Mamadashvili Date: Tue, 8 Nov 2022 22:58:54 +0400 Subject: [PATCH 2/2] Link to the trac ticket Co-authored-by: Jonathan Desrosiers --- src/wp-includes/class-wp-theme-json.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/wp-includes/class-wp-theme-json.php b/src/wp-includes/class-wp-theme-json.php index 346634edca0f9..d0fcdeb52a3c6 100644 --- a/src/wp-includes/class-wp-theme-json.php +++ b/src/wp-includes/class-wp-theme-json.php @@ -398,6 +398,7 @@ class WP_Theme_JSON { * This is to ensure that 'visited' has the lowest specificity * and the other selectors can always overwrite it. * + * See https://core.trac.wordpress.org/ticket/56928. * Note: this will affect both top-level and block-level elements. * * @since 6.1.0