Skip to content

Core block styles are overriding theme.json styles in WordPress 6.6 #62679

Closed

Description

Description

If you have applied styles to specific elements in theme.json, perhaps blocks as well, there is a chance that they will be overridden by default block styles. I have not had a chance to test this issue widely, but I discovered (with the help of @bgardner) that the element styles in theme.json for Image block captions are no longer respected in 6.6.

Take a look at the screenshots below. You will see that the specificity changes in #61638 seem to have swapped the style order. This causes the block style to override theme.json. In my opinion, theme.json should always "beat" default block styles.

Step-by-step reproduction instructions

  1. Use the Twenty Twenty-Four theme and WordPress 6.6 Beta 3+
  2. Add an image with a caption to the page
  3. In theme.json, add the following to the caption element
"spacing": {
	"margin": {
		"top": "10px",
		"bottom": "0"
	}
}
  1. View the image on the front end and see that the block styles override for margin override those set in the theme.json

Screenshots, screen recording, code snippet

WordPress 6.5 WordPress 6.6
image image

Environment info

  • WordPress 6.6 Beta 3+
  • Gutenberg 18.5

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

Global StylesAnything related to the broader Global Styles efforts, including Styles Engine and theme.json[Priority] HighUsed to indicate top priority items that need quick attention[Status] In ProgressTracking issues with work in progress[Type] BugAn existing feature does not function as intended

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions