Make WordPress Core

Opened 17 months ago

Closed 15 months ago

Last modified 14 months ago

#57053 closed enhancement (fixed)

Themes: Support additional link related pseudo classes in `theme.json`.

Reported by: peterwilsoncc's profile peterwilsoncc Owned by: audrasjb's profile audrasjb
Milestone: 6.2 Priority: normal
Severity: normal Version:
Component: Themes Keywords: has-patch commit add-to-field-guide
Focuses: css Cc:

Description

class-wp-theme-json.php is currently missing the :link and :any-link pseudo classes as valid selectors:

<?php
const VALID_ELEMENT_PSEUDO_SELECTORS = array(
        'link'   => array( ':visited', ':hover', ':focus', ':active' ),
        'button' => array( ':visited', ':hover', ':focus', ':active' ),
);

:link can be used to style unvisited links and has wide browser support; :any-link can be used to style links containing an `href` attribute but is unsupported in Safari browsers.

Similar to the issue faced in #56928, order is important. These would need to be added at the start of the lists.

Change History (11)

This ticket was mentioned in PR #3631 on WordPress/wordpress-develop by @whaze.


17 months ago
#1

  • Keywords has-patch added; needs-patch removed

Added :link and :any-link to VALID_ELEMENT_PSEUDO_SELECTORS array

Maybe we should change the corresponding docblock

Trac ticket: https://core.trac.wordpress.org/ticket/57053

#3 @audrasjb
17 months ago

  • Milestone changed from Awaiting Review to 6.2
  • Owner set to audrasjb
  • Status changed from new to accepted

I think we're ready to go now :)

Moving for 6.2 consideration.

This ticket was mentioned in Slack in #core by mukeshpanchal27. View the logs.


15 months ago

#5 @mukesh27
15 months ago

  • Keywords commit added

As discuss in today's bug scrub PR looks good to go!

commit keyword added.

Prop to @costdev.

#6 @audrasjb
15 months ago

  • Resolution set to fixed
  • Status changed from accepted to closed

In 55121:

Themes: Support additional link related pseudo classes in theme.json.

This changeset adds support for :link and :any-link in theme.json, using the VALID_ELEMENT_PSEUDO_SELECTORS array. :link can be used to style unvisited links and :any-link can be used to style any link containing an href attribute.

Props peterwilsoncc, whaze, audrasjb, costdev, mukesh27.
Fixes #57053.

#8 @milana_cap
14 months ago

  • Keywords add-to-field-guide added

@oandregal commented on PR #3631:


14 months ago
#9

:wave: Hey, this sort of changes need to be ported back to Gutenberg. I've prepared a PR for this at https://github.com/WordPress/gutenberg/pull/48634

#10 @oandregal
14 months ago

:wave: Hey, this sort of changes need to be ported back to Gutenberg. I've prepared a PR for this at https://github.com/WordPress/gutenberg/pull/48634

#11 @leemon
14 months ago

The :link and :any-link pseudo classes don't appear in the 6.2 theme.json schema:
https://raw.githubusercontent.com/WordPress/gutenberg/wp/6.2/schemas/json/theme.json

Note: See TracTickets for help on using tickets.