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

Support :hover on block level #49716

Open
cawa-93 opened this issue Apr 11, 2023 · 2 comments
Open

Support :hover on block level #49716

cawa-93 opened this issue Apr 11, 2023 · 2 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

@cawa-93
Copy link
Contributor

cawa-93 commented Apr 11, 2023

What problem does this address?

Currently, we can specify styles per block and :hover for elements inside block. But we can't cpesify :hover styles on block itself.
For example:

// theme.json
{
	"styles": {
		"blocks": {
			"core/button": {
				"typography": {
					"textTransform": "uppercase"
				},
				"elements": {
					"link": {
						":hover": {
							"typography": {
								"textTransform": "lowercase"
							}
						}
					}
				}
			}
		}
	}
}

Will generate

.wp-block-button .wp-block-button__link{text-transform: uppercase;}
.wp-block-button .wp-block-button__link a:where(:not(.wp-element-button)):hover{text-transform: lowercase;}

But needed css is:

.wp-block-button .wp-block-button__link{text-transform: uppercase;}
.wp-block-button .wp-block-button__link:hover{text-transform: lowercase;}

What is your proposed solution?

Provide support for pseudo classes like :focus or :hover on block level.

{
	"styles": {
		"blocks": {
			"core/button": {
				"typography": {
					"textTransform": "uppercase"
				},
				":hover": { // currently has no effect
					"typography": {
						"textTransform": "lowercase"
					}
				}
			}
		}
	}
}
@kathrynwp
Copy link

Related: #4543

@kathrynwp kathrynwp 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 Apr 11, 2023
@mikachan
Copy link
Member

Also related: #38277

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

3 participants