Following on from #39601 where we removed the blockGap / block spacing controls in global styles (since the gap value is not currently supported at the block level in global styles), this issue proposes a way to add it back in!
As of #37360 where the CSS variable approach for blockGap was removed, we haven't had support for blockGap at the individual block level in global styles or theme.json. One possible path forward to re-instating it could be:
- Every block that uses the layout support is server-rendered and currently attempts to grab the block gap value from the block's attributes, and if it doesn't exist, falls back to using the global blockGap CSS variable.
- Can we add in logic in
layout.php and in the JS rendering for the layout support so that if the block's attributes do contain a blockGap setting we then look-up theme.json to grab the blockGap value if one is set at the corresponding block name level?
- If this approach works, also roll it out to the Gallery block's custom code that implements gap support.
Following on from #39601 where we removed the blockGap / block spacing controls in global styles (since the gap value is not currently supported at the block level in global styles), this issue proposes a way to add it back in!
As of #37360 where the CSS variable approach for
blockGapwas removed, we haven't had support forblockGapat the individual block level in global styles ortheme.json. One possible path forward to re-instating it could be:layout.phpand in the JS rendering for the layout support so that if the block's attributes do contain ablockGapsetting we then look-uptheme.jsonto grab theblockGapvalue if one is set at the corresponding block name level?