From 6f6a158597eb4be8c5fb8cf545dfc74ec28ffe9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9?= <583546+oandregal@users.noreply.github.com> Date: Wed, 1 Mar 2023 13:59:48 +0100 Subject: [PATCH 1/2] Backport support for :link and :any-link --- lib/class-wp-theme-json-gutenberg.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/class-wp-theme-json-gutenberg.php b/lib/class-wp-theme-json-gutenberg.php index 4d688bb5b8b83c..40196a9fea69fe 100644 --- a/lib/class-wp-theme-json-gutenberg.php +++ b/lib/class-wp-theme-json-gutenberg.php @@ -465,18 +465,20 @@ class WP_Theme_JSON_Gutenberg { /** * 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. + * The order of the selectors should be: link, any-link, visited, hover, focus, 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. * * See https://core.trac.wordpress.org/ticket/56928. * Note: this will affect both top-level and block-level elements. * * @since 6.1.0 + * @since 6.2.0 Added support for ':link' and ':any-link'. */ const VALID_ELEMENT_PSEUDO_SELECTORS = array( - 'link' => array( ':visited', ':hover', ':focus', ':active' ), - 'button' => array( ':visited', ':hover', ':focus', ':active' ), + 'link' => array( ':link', ':any-link', ':visited', ':hover', ':focus', ':active' ), + 'button' => array( ':link', ':any-link', ':visited', ':hover', ':focus', ':active' ), ); /** From 6269ea5006216c5b10d399f40da0e0244ea4c7f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9?= <583546+oandregal@users.noreply.github.com> Date: Thu, 2 Mar 2023 14:29:36 +0100 Subject: [PATCH 2/2] Update lib/class-wp-theme-json-gutenberg.php Co-authored-by: Mukesh Panchal --- lib/class-wp-theme-json-gutenberg.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/class-wp-theme-json-gutenberg.php b/lib/class-wp-theme-json-gutenberg.php index 40196a9fea69fe..224172b3f6c6f4 100644 --- a/lib/class-wp-theme-json-gutenberg.php +++ b/lib/class-wp-theme-json-gutenberg.php @@ -474,7 +474,7 @@ class WP_Theme_JSON_Gutenberg { * Note: this will affect both top-level and block-level elements. * * @since 6.1.0 - * @since 6.2.0 Added support for ':link' and ':any-link'. + * @since 6.2.0 Added support for `:link` and `:any-link`. */ const VALID_ELEMENT_PSEUDO_SELECTORS = array( 'link' => array( ':link', ':any-link', ':visited', ':hover', ':focus', ':active' ),