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

Button: Add support for :hover in variation theme.json #55359

Open
richtabor opened this issue Oct 13, 2023 · 6 comments
Open

Button: Add support for :hover in variation theme.json #55359

richtabor opened this issue Oct 13, 2023 · 6 comments
Labels
[Block] Buttons Affects the Buttons Block Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json [Type] Enhancement A suggestion for improvement.

Comments

@richtabor
Copy link
Member

I expected to be able to manipulate the hover state of variations from theme.json. I can define the other default state attributes, but hover is not supported. Ran into this while exploring adding more variety to the buttons in TT4 theme variations: WordPress/twentytwentyfour#646

CleanShot 2023-10-13 at 15 38 51
CleanShot 2023-10-13 at 15 41 42

Related to #49716.

@richtabor richtabor added [Type] Enhancement A suggestion for improvement. [Block] Buttons Affects the Buttons Block Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json labels Oct 13, 2023
@masteradhoc
Copy link
Contributor

+1 in getting this into theme.json and also in Global Styles

@pablost88
Copy link

I had the same issue a few days ago. My workaround was to add some css to the core/buttons block using the "css" attribute. Hope it helps

image

@philhoyt
Copy link

+1 hover states in theme.json and global styles would be welcomed!

@Zealth57
Copy link

Also related #51337 and #64362 and discussed in #core dev chat today. Seems to becoming a consensus that at minimum we should expose some APIs to allow developers to implement better controls in the Elements. This would allow the flexibility to create states or create more flexible elements as needed.

@joemcgill
Copy link
Member

The related PR: #67541 makes some initial progress on this.

@carolinan
Copy link
Contributor

carolinan commented Dec 18, 2024

This is unrelated to the stylebook, and it is unrelated to the type of elements available.

Elements and variations can both be used under styles and under styles > blocks > block name.
But elements can not be used under variations.

But the following is also problematic because the button element is not part of the button block.
Even if this was possible, it wouldn't apply any styles:
core/button > variations > slug > elements > button > hover

And with this, it would be unclear what to apply the hover on:
any other complex block > variations > slug > hover
any other complex block > variations > slug > elements > hover

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Buttons Affects the Buttons Block Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

No branches or pull requests

7 participants