Skip to content

Conversation

@cyruscollier
Copy link

@cyruscollier cyruscollier commented Oct 18, 2025

There are 2 margin-related issues with the Row Layout block that this PR addresses:

  1. Rowlayout uses its own version of getSpacingOptionOutput() that does not correctly return an empty string for all false-y values, including '' and null. This results in the margin reset state to not work. Now the block uses the shared version of this function from @kadence/helpers that correctly handles these false-y values.

  2. There are editor-only styles that zero out the top and bottom margins of the Rowlayout block. This can conflict with theme styles, especially due to their high specificity, resulting in inconsistent visual spacing between the editor preview and the front end display. Since there isn't an apparent need for these styles, they have been removed so that default theme margins can render correctly in both the preview and front end.

Checklist

  • I have performed a self-review.
  • No unrelated files are modified.
  • No debugging statements exist (Ex: console.log, error_log).
  • There are no warnings or notices in the wordpress error log.
  • Passes all tests (linting, acceptance, & unit)

Block specific checklist (where relevant)

  • Tested with an existing instance of this block .
  • Tested creating a new instance of this block.
  • Tested with Dynamic content & Elements.

@cyruscollier cyruscollier marked this pull request as ready for review October 18, 2025 21:39
@mark-c-woodard
Copy link
Contributor

@cyruscollier
Point one looks good, thanks for the find!

Point two, we reset the margins on most of our blocks because gutenberg adds margins on blocks, so this is just to ensure that doesn't mess with us.
Was there a specific inconsistency your were dealing with? I think I'd prefer to handle those indivdually.

@cyruscollier
Copy link
Author

Hey @mark-c-woodard, yes, in our case we are using Kadence Blocks in combination with core blocks and a strict design system configured in theme.json. Our theme (and many others, I would imagine) relies on these core styles to control things like default space between blocks. By having a rule cancelling out the margin (in the editor only), it's effectively breaking the Gutenberg theme.json system while also introducing a visual inconsistency between the editor preview and front end. So far, this margin override seems to be limited to the Row Layout block; we haven't seen it on other blocks we've starting using, like Tabs, Accordions or Testimonials.

If you feel like removing this margin override might be too much of a breaking change, would you consider a configuration option to turn this margin on or off? In either case, it seems like this margin override should be applied to both the editor and front end to at least be internally consistent.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants