Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for :link and :any-link in theme.json #48634

Merged
merged 2 commits into from
Mar 2, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions lib/class-wp-theme-json-gutenberg.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'.
oandregal marked this conversation as resolved.
Show resolved Hide resolved
*/
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' ),
);

/**
Expand Down