From 63f944e831b53901e1a4b166ba09df99f94c0f99 Mon Sep 17 00:00:00 2001 From: Peter Wilson Date: Wed, 9 Nov 2022 04:08:16 +0000 Subject: [PATCH] Themes: Re-order valid link pseudo classes. Re-order the link pseudo classes to follow the long term LoVe (F)HA rule when set via `theme.json`. In order that the CSS cascade behaves in a predictable manner, it's recommended that the selectors follow the order `:visited`, `:focus`/`:hover`, `:active`. As order affects the specificity, this ensures the interaction states override the visited states. CSS specificity is really quite beautiful, although complex. Props mikachan, sabernhardt, davidbaumwald, mukesh27, Mamaduka, desrosj. Fixes #56928. Built from https://develop.svn.wordpress.org/trunk@54774 git-svn-id: http://core.svn.wordpress.org/trunk@54326 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/class-wp-theme-json.php | 9 +++++++-- wp-includes/version.php | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/wp-includes/class-wp-theme-json.php b/wp-includes/class-wp-theme-json.php index 555898370f..d0fcdeb52a 100644 --- a/wp-includes/class-wp-theme-json.php +++ b/wp-includes/class-wp-theme-json.php @@ -394,13 +394,18 @@ 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. + * + * See https://core.trac.wordpress.org/ticket/56928. * 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' ), ); /** diff --git a/wp-includes/version.php b/wp-includes/version.php index 6d0fb03fd9..6175f8b2c3 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.2-alpha-54771'; +$wp_version = '6.2-alpha-54774'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.