Adds example state to link element#41331
Conversation
|
Does this also work in the Site Editor? You might need to update the array here too |
|
Hello! Just cross-linking to an open style engine PR that generates styles for the existing It currently outputs the link colors as before. I don't see any conflicts here, and am happy to test things further. Cheers! |
|
@scruffian thanks for the tip 😁 done in 6d24868 |
|
Size Change: +193 B (0%) Total Size: 1.24 MB
ℹ️ View Unchanged
|
getdave
left a comment
There was a problem hiding this comment.
This looks like a good start.
Screen.Capture.on.2022-05-26.at.16-14-48.mp4
I tried this on the Nav block to try and style the :hover effect on all a elements. I thought it wasn't working but then when I forced the :hover state via devtools it worked. Is there a pointer-events stopping this :hover applying via normal mouseover?
| */ | ||
| const ELEMENTS = array( | ||
| 'link' => 'a', | ||
| 'link:hover' => 'a:hover', |
There was a problem hiding this comment.
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`.
What?
Exploration start for #38277
Why?
We should have a way to define via
theme.jsonstate based styles for elements (and blocks?).How?
Just adding a state as a selector mapping to
WP_Theme_JSON::ELEMENTSTesting Instructions
theme.jsonin TwentyTwentyTwo by adding the code below under styles > elements:Screenshots or screencast
simple-state-fix.mp4