Layout: top margin overwrites theme.json block CSS when gap support enabled #35411
Labels
[Block] Columns
Affects the Columns Block
CSS Styling
Related to editor and front end styles, CSS-specific issues.
[Feature] Design Tools
Tools that impact the appearance of blocks both to expand the number of tools and improve the experi
[Type] Bug
An existing feature does not function as intended
Description
Since Gutenberg 11.7 (in #34491), the
gutenberg_get_layout_style
method adds the following CSS to.wp-block-post-content
children and their adjacent siblings where block spacing support (A.K.AblockGap
) is enabled:See layout.php.
Block spacing support was introduced in #33991.
For blocks that have opted-in to block spacing, such as the Columns block or in the PR for the Social Links block, this CSS's specificity overwrites any block-specific top and bottom margins in
theme.json
.Noticed by @stacimc when testing #35374 (comment) 👍
Step-by-step reproduction instructions
Set a top and bottom margin for the
core/columns
block in yourtheme.json
In a new post, insert a Columns Block as a second block, for example, insert a paragraph first, then columns.
Save the post and inspect the styles.
What I expected
The
theme.json
styles would take precedence over any plugin-generated block layout styles.What happened
The plugin-generated block layout styles take precedence. See screenshot below.
Screenshots, screen recording, code snippet
Environment info
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
The text was updated successfully, but these errors were encountered: