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

Adds example state to link element #41331

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
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
7 changes: 7 additions & 0 deletions lib/compat/wordpress-6.1/class-wp-theme-json-6-1.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,15 @@
class WP_Theme_JSON_6_1 extends WP_Theme_JSON_6_0 {
const __EXPERIMENTAL_ELEMENT_BUTTON_CLASS_NAME = 'wp-element-button';

/**
* The valid elements that can be found under styles.
*
* @since 5.8.0
* @var string[]
*/
const ELEMENTS = array(
'link' => 'a',
'link:hover' => 'a:hover',
Copy link
Contributor

@getdave getdave May 26, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have to confess I was expecting:

"link" {
    "color": {
        "text": "red"
    },
    ":hover": {
        "color": {
            "text": "hotpink"
        }
    }
}

But now I'm thinking what you have looks more like CSS whereas my expectations is more like SASS.

We could also look to auto map the :hover. So from link mapping to a we can automatically create the mapping for link:hover => a:hover. This would also allow us to map for various other pseudo classes such as :focusand:active`.

'h1' => 'h1',
'h2' => 'h2',
'h3' => 'h3',
Expand Down
1 change: 1 addition & 0 deletions packages/blocks/src/api/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ export const __EXPERIMENTAL_STYLE_PROPERTY = {

export const __EXPERIMENTAL_ELEMENTS = {
link: 'a',
'link:hover': 'a:hover',
h1: 'h1',
h2: 'h2',
h3: 'h3',
Expand Down