What problem does this address?
The block inspector currently sets a margin bottom on all BaseControl components.
|
.components-base-control { |
|
margin-bottom: #{ $grid-unit-30 }; |
|
|
|
&:last-child { |
|
margin-bottom: $grid-unit-10; |
|
} |
|
} |
This was probably convenient at the time, when flexbox was yet to be widely available. Now, it is hindering our ability to use modern layout methods like flex and grid. And devs are going to need a way to space out elements that are not BaseControl-based anyway.
Some consumers are forced to override the margin added by the block inspector so they can handle their own layout:
|
.wp-block-search__inspector-controls { |
|
.components-base-control { |
|
// Counteract the margin added by the block inspector. |
|
margin-bottom: 0; |
|
} |
|
} |
What is your proposed solution?
The pathway I have in mind at the moment is:
What problem does this address?
The block inspector currently sets a margin bottom on all BaseControl components.
gutenberg/packages/block-editor/src/components/block-inspector/style.scss
Lines 13 to 19 in cf8aeba
This was probably convenient at the time, when flexbox was yet to be widely available. Now, it is hindering our ability to use modern layout methods like
flexandgrid. And devs are going to need a way to space out elements that are not BaseControl-based anyway.Some consumers are forced to override the margin added by the block inspector so they can handle their own layout:
gutenberg/packages/block-library/src/search/editor.scss
Lines 20 to 25 in 20a0eda
What is your proposed solution?
The pathway I have in mind at the moment is:
__nextprop and/or data attribute so certain container components can opt out of the automatic margin-bottom on BaseControl. Ideally we'd expose the prop only onInspectorControlsand not on any@wordpress/componentscomponents.spacingis 8px instead of the 16px we want in the inspector)? Is it a new, dedicated layout component (Implement a standard "controls grid" component for sidebar #43423)? To be decided.