-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add margin support to Separator block #28451
Conversation
Adding visualizers for margin Visualizer for inner blocks remove padding visualizer flickering fix spread values extract styles to a separate configuration object Allow auto margin unit Fix spreading of values Patch Current UnitControl Allow only margin to have an auto value unit validation fixed dragging on spacing units fixed unlink on default state fix: Initial value not set up
Wow I did not even think of that! Margin creates a multi faceted approach to width, alignment (want the line to the left add a lot of right margin), and placement of space. It gives the user a lot of creativity in how to design the separator line. Now would using padding change the thickness of the line? I believe that the PR would need some feedback |
Jon @ItsJonQ and Joen @jasmussen would probably want to know about the PR as well. |
Cool work! Thanks for all your effort 🏅 There's an important conversation to be had about how spacing like this should be a global style property that can then be enabled on a per-block basis. Both because I could see spacing properties be surfaced on many more blocks than just the separator, but also because for that to happen in a way that doesn't explode the sidebar interface, we need a design and system for surfacing such controls in the sidebar. #27331 just happens to touch on both of those issues. So my primary question here isn't around the feature — big fan — but rather about the order in which we do things. If we do this now, for the separator block, does that cause headaches for us in the future when a spacing block property lands in global styles and becomes more of an opt-in? Something to think about, and when you feel this is ready for more eyes, maybe ping the gutenberg-core group for review! |
@jasmussen Thanks for the thoughts. I'm not sure the feedback is entirely applicable. In this PR, the spacing support is added by a block support property and can be theme-controlled (which seems to be the same thing you are referring to as a global style property, not sure). I have no strong opinion about this feature. The PR was made as an exploration to offer a different approach to #28409. To which your feedback may be more relevant as it adds the feature and controls in an ad hoc manner. |
Some folks would like to be able to control the height of the Separator block #25989. This PR enables that by adding support for custom margins. It depends on the changes from #25988 that introduce the margin support flag and also includes those for ease of testing.
Testing this requires a theme that enables Spacing block support so Twenty Twenty One is a good one.
This would, I think, satisfy and close #25989.
How has this been tested?
Trying various margin settings on a Separator block and previewing on the frontend.
Screenshots
separator-margin.mp4
Types of changes
feature
Checklist: