gutenberg icon indicating copy to clipboard operation
gutenberg copied to clipboard

theme.json - defining styles with variable no longer shows selection in global styles panel

Open Sandstromer opened this issue 5 years ago • 2 comments

Description

Previously prior to 10.9 one could define styles in the theme.json with variables and the selection would be shown as checked in the global styles panel.

Now with 10.9 the style must be explicitly defined for the selection to be shown in the global styles panel.

An example would be defining the background color like so (this did previously show the white color checked):

"styles": {
    "color": {
        "background": "var(--wp--preset--color--white)"

Now though it has to be defined like this (it does not show the white color checked unless defined like this):

"styles": {
    "color": {
        "background": "#ffffff"

WordPress information

  • WordPress version:
  • Gutenberg version: 10.9
  • Are all plugins except Gutenberg deactivated? Yes
  • Are you using a default theme (e.g. Twenty Twenty-One)? Various themes, all same result

Device information

  • Device:
  • Operating system:
  • Browser:

Sandstromer avatar Jun 23 '21 19:06 Sandstromer

Thanks for reporting. Are you able to reproduce this after installing and activating the newest version of Gutenberg that is available through the Gutenberg plugin?

I am unable to reproduce the bug you're seeing when I test against the newest version of Gutenberg, 11.3.0. When I define background color in theme.json like this:

"styles": {
    "color": {
        "background": "var(--wp--preset--color--white)"

I see the white background color on my site as expected, and the selection is checked in the Global Styles panel: Screen Shot 2021-08-27 at 9 43 04 AM

stacimc avatar Aug 27 '21 16:08 stacimc

@stacimc thanks for reminding me of this issue. It seems to work as expected now in the latest release, so I'll go ahead and close this.

Sandstromer avatar Aug 28 '21 09:08 Sandstromer