-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
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
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
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`.
What?
Exploration start for #38277
Why?
We should have a way to define via
theme.json
state based styles for elements (and blocks?).How?
Just adding a state as a selector mapping to
WP_Theme_JSON::ELEMENTS
Testing Instructions
theme.json
in TwentyTwentyTwo by adding the code below under styles > elements:Screenshots or screencast
simple-state-fix.mp4