Site Editor: global styles not selected when defined with variable #28853
Labels
[Feature] Site Editor
Related to the overarching Site Editor (formerly "full site editing")
Global Styles
Anything related to the broader Global Styles efforts, including Styles Engine and theme.json
[Type] Bug
An existing feature does not function as intended
Description
In the Global Styles sidebar of the Site Editor, where a style is defined using a variable in theme.json, the relevant control is not selected as the default defined style.
Step-by-step reproduction instructions
Activate a FSE theme with a theme.json file that has defined 'defaults' and 'styles'.
The 'styles' should be defined with variable e.g.
"fontSize": "var(--wp--preset--font-size--normal)"
Go into the Site Editor and notice that although the relevant element is displayed with the correct style, the control selector is not selected as defined, so it is not immediately obvious what style the theme has defined.
If the styles are explicitly defined e.g.
"fontSize": "20px"
then the control selector does default to the correct style.See code examples and screenshots.
Define some default font sizes and colors in theme.json, and also some styles defined by using variables:
In the screenshot, the Font Size selector should show that it is set to be 'Normal', and the Text Color should be checked on the black color:
Now in this example, the styles have instead been defined with explicit values that match with the defaults:
Now, we can see that the relevant controls do show us what has been defined, the Font Size shows 'Normal' font size and the Text Color shows the black color selected:
WordPress information
Device information
The text was updated successfully, but these errors were encountered: