WordPress / gutenberg

The Block Editor project for WordPress and beyond. Plugin is available from the official repository.
https://wordpress.org/gutenberg/
Other
10.49k stars 4.18k forks source link

Group block: Add horizontal margin support when direct descendant of a row #60997

Open andersnoren opened 6 months ago

andersnoren commented 6 months ago

What problem does this address?

By default, the group block only supports setting vertical margins:

image

This makes sense in most cases.

However, when the group block is inside of a row block, you might want to be able to set a horizontal margin on the group block, to modify the space between the group and other blocks in the row block. You can set a block spacing value on the row as well, but there are many scenarios where you want different margin values on different child blocks inside the row. Right now, this isn't possible with the group block.

image

What is your proposed solution?

When the group block is a direct descendant of a row block, it should support horizontal margin values as well as vertical.

richtabor commented 6 months ago

I ran into this as well.

The tricky bit with the Group block is that margin left/right auto is applied within constrained layouts. Should left and right margin be available when not in a constrained layout instead?

andersnoren commented 6 months ago

The tricky bit with the Group block is that margin left/right auto is applied within constrained layouts. Should left and right margin be available when not in a constrained layout instead?

@richtabor I'd be in favor of that.