Skip to content

Styling core/group variations in theme.json not working #59186

@mcshaman

Description

@mcshaman

Description

As documented in the Wordpress Theme Handbook you are able to customise the default styles of blocks in the theme.json. This appears to work fine for blocks such as core/button however it doesn't seem to work for group variations such as group-row or group-stack.

As noted in this Wordpress blog article Row and Stack blocks are actually just variations of the group block.

I wan't to be able to apply different blockGap spacing on group-row and group-stack as opposed to the default group block and this seems like the way it should be able to be done.

Step-by-step reproduction instructions

  1. add the following to theme.json:
{
  "version": 2,
  "styles": {
    "blocks": {
      "core/group": {
        "variations": {
          "group-stack": {
            "color": {
              "background": "green"
            }
          }
        }
      }
    }
  }
}
  1. add a stack block to page and notice style not applied

Screenshots, screen recording, code snippet

No response

Environment info

WordPress 6.4.3
According to WordPress my install should be using Gutenburg 16.2-16.7
Custom theme
Chrome 121.0.6167.184
macOS 14.3.1

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

Metadata

Metadata

Assignees

No one assigned

    Labels

    Global StylesAnything related to the broader Global Styles efforts, including Styles Engine and theme.json[Block] GroupAffects the Group Block (and row, stack and grid variants)[Feature] Block Style VariationsIssues or PRs that are related to the style variations for blocks[Type] BugAn existing feature does not function as intended

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions