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, peterwilsoncc.
Fixes #56928.
Built from https://develop.svn.wordpress.org/branches/6.1@54778


git-svn-id: http://core.svn.wordpress.org/branches/6.1@54330 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
desrosj 2022-11-09 16:30:13 +00:00
parent 73cd0d0c47
commit 2855b38359
2 changed files with 8 additions and 3 deletions

View File

@ -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' ),
);
/**

View File

@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '6.1.1-alpha-54773';
$wp_version = '6.1.1-alpha-54778';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.