Skip to content

The margin added at the top level styles (for body) in theme.json is override by a margin added from gutenberg #36147

@overclokk

Description

@overclokk

Description

If I add a margin property to the theme.json at the top level styles the style generated is overwritten by a style added by the gutenberg plugin.

I also tried with the 2022 theme and gutenberg active.

Step-by-step reproduction instructions

Gutenberg plugin is activated.
Theme 2022 activated

Add this to theme.json

{
	"styles": {
		"spacing": {
			"margin": "0 5rem",
			"padding": "0"
		},
	}
}

See the source of the page.
In my test I see this in the source:

body { // This is added by the theme.json
	margin: 0 5rem;
	padding: 0;
	--wp--style--block-gap: 1.5rem;
}
body { margin: 0; } // This is added by the gutenberg plugin

Screenshots, screen recording, code snippet

No response

Environment info

WP latest
Gutenberg Latest fro repo
Theme 2022

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

Labels

Global StylesAnything related to the broader Global Styles efforts, including Styles Engine and theme.json[Status] In ProgressTracking issues with work in progress[Type] BugAn existing feature does not function as intended

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions