Make WordPress Core

Opened 3 weeks ago

Last modified 5 days ago

#65263 new defect (bug)

Colors from theme.json doesnt parse for hover states

Reported by: tonnysantana's profile tonnysantana Owned by:
Milestone: 7.0.1 Priority: normal
Severity: normal Version: 7.0
Component: Editor Keywords: needs-testing
Focuses: javascript, css Cc:

Description

When using variables from the theme.json, the value is not parsed and doesn't save in the hover state for buttons.

You can test going to the site editor > styles > blocks > button & selecting a color from the theme.json in the hover state. It is not going to save unless you use a raw value that were not been saved in the theme.

https://yourwp.local/wp-admin/site-editor.php?p=%2Fstyles&section=%2Fblocks

If it somehow work with the default colors, try create a new one in the theme.json

thank you

Change History (4)

#1 @audrasjb
3 weeks ago

Removing trunk version as this is not going to be shipped with WP 7.0 but in the next releases.

#2 @audrasjb
3 weeks ago

  • Milestone changed from Awaiting Review to 7.0.1
  • Version trunk deleted

#3 @desrosj
3 weeks ago

  • Version set to trunk

@tonnysantana thanks for this! And welcome to Trac!

It's possible that this may require some discussion upstream in the Gutenberg repository. Could you open an issue there as well?

I'm unclear whether this is a regression specific to 7.0 or not, so re-adding the trunk version until that can be clarified.

#4 @wildworks
5 days ago

When using variables from the theme.json, the value is not parsed and doesn't save in the hover state for buttons.

I tested using the following Theme.json, and the colors were applied correctly according to the button state.

{
	"version": 3,
	"settings": {
		"appearanceTools": true,
		"layout": {
			"contentSize": "840px"
		}
	},
	"styles": {
		"blocks": {
			"core/button": {
				":hover": {
					"color": {
						"background": "#ff0000"
					}
				},
				":focus": {
					"color": {
						"background": "#00ff00"
						}
				},
				":active": {
					"color": {
						"background": "#0000ff"
					}
				}
			}
		}
	}
}

@tonnysantana It would be helpful if you could provide more details about how you define your theme.json, what specific actions you've taken, and what problems you're encountering, so that other contributors can test it.

Note: See TracTickets for help on using tickets.