You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Optimise and condense unlinked padding / margin controls #49264
When padding / margin controls are unlinked (for per-side settings) they occupy an enormous amount of real estate. It's particularly bad when you unlink both. On my 16" MacBook they fill the entire Inspector 🙈 :
This feels especially bad when you only want to apply padding / margin to a single side which is not uncommon.
What is your proposed solution?
Use dynamic two-tone icons to let you select sides:
All sides (split into separate axial controls) by default
Individual sides
Entirely custom per-side borders
Issue updated Apr 13.
See initial proposal
I think we can optimise for single-side value application by allowing folks to choose where the padding / margin is applied in a popover menu containing the following options:
All sides (default)
Top
Right
Bottom
Left
Custom
The custom option would effectively be the same as the current 'Unlink' option and provide a dedicated control for each sides. In this case I think we can condense by arranging the controls into columns.
Here's a visual which (hopefully) describes things a bit better:
As you can see the footprint of both single-side and unlinked control instances is significantly reduced.
Reacted by Timothy Jacobs, Andy Peatling and Brian Alexander
That is a very good idea! I like the compact view in the last mockup!
The only thing that comes up is if the controls become too small to handle.
It would be interesting to try out!
It would really be good if a new design for the slider could solve the unset/inherit/default problem described in #43082 (comment). Would this design also look identical to "none" before it's been modified?
Separately and more focused on this specific issue, have you considered arranging them in a + shape to make it very clear what slider is associated with each side?
(Pardon my very quick rearrangement of the screenshot above, the spacing and alignment is definitely sloppy)
I have a draft PR up in #50660. There's still a lot left to polish so take it with a grain of salt.
It also still retains the linked/all sides view for the control. Mainly due to covering the potential for odd side support configurations on custom blocks such as ["top", "right", "bottom" ]. It also keeps the initial footprint to a minimum which seemed in the spirit of this issue but I'm happy to iterate from here.
Other than that, I have two further questions;
Do we still want to retain the hints similar to the old version of the control?
In the old control we would render a hint beside the label.
With the new design we don't necessarily have a label to render a hint beside.
If we were to keep the linked/all sides view, should we omit the axial view if only one axis is supported?
If we have a sides configuration of ["top", "bottom"], the axial view ("Vertical") is almost the same as the all sides view.
The main difference is that the axial view has a duplicate vertical icon
No doubt, I'll have further questions as we iterate but that's about all my brain can handle for today 🙂
For me, the hints aren't super useful and just add noise. So I'd be fine with losing them.
If we were to keep the linked/all sides view, should we omit the axial view if only one axis is supported?
Is the sides configuration already built into the control? It seems a bit strange to limit sides for which a user can add/edit padding 🤔 If it is, then yes it probably doesn't make sense to show the option(s) for disabled configs. Apologies if I am misunderstanding the question. FWIW I still lean towards omitting the linked/all sides view. It's quite rare to need equal vertical & horizontal padding.
For me, the hints aren't super useful and just add noise. So I'd be fine with losing them.
👍 Sounds like a plan. I'll leave them out.
Is the sides configuration already built into the control?
That is correct. The ability to configure any supported sides from top, right, bottom, left, was added as far back as April 2021. It was extended shortly after that to allow axial sides (horizontal & vertical) to be supported in the block.json sides config.
It seems a bit strange to limit sides for which a user can add/edit padding
I agree. There are a couple of blocks that restrict padding to only the axial sides i.e. horizontal & vertical, no support for individual sides. The button block is the primary example there.
It is possible for 3rd party blocks to have configured their sides however they wanted. So any subset of [ top, right, bottom, left, horizontal, vertical ]
The other thing worth noting here is that this same approach to sides configuration applies to all spacing block supports and they all (margin, block gap etc) share this same spacing control.
If it is, then yes it probably doesn't make sense to show the option(s) for disabled configs
The current state of #50660 doesn't show any controls for disabled sides. The issue is when only one axial side is supported via ["top", "bottom"], the "linked" view is effectively the same as the "axial" view which would only be showing a single control as well.
Screen.Recording.2023-05-17.at.7.08.36.pm.mp4
Regarding the inclusion of the "linked" view, I kept it for the moment as noted to cover a sides configuration that doesn't neatly align with the horizontal and vertical axial views.
A contrived example might be a 3rd party block, using an inner blocks template with a custom child block. It might have that custom child block styled to appear in the top-right corner and they wish to allow the configuration of margin for only the left and bottom sides. (I did say contrived 🙂). In such a situation, I don't think it makes sense to default to the "axial" view.
We could default to the "custom" view containing all the separated controls. Would that be undermining the effort to reduce the footprint of this control? Or is it an edge case we can safely ignore for the time being?
Left, Bottom
Top, Bottom, Left
Screen.Recording.2023-05-17.at.7.10.53.pm.mp4
Screen.Recording.2023-05-17.at.7.11.56.pm.mp4
I'm happy to iterate on #50660 however you'd like it. I can certainly remove the "linked" view, or we could only include it for those edge case configurations like [top, bottom, left] etc. where it might be more useful.
Thanks for the guidance and direction on this one 🙇
We could default to the "custom" view containing all the separated controls.
In your example, this makes the most sense to me. I don't think it undermines the "reduce the footprint" objective because only the editable sides would be represented, so in this case two controls. It does also feel a bit of an edge case that we can perhaps circle back to.
I have a question that is tangential to this specific PR, but it came to mind while observing the current WIP: for languages with different writing directions (ie. RTL, or even top to bottom), how do we handle these margins? Ie. is "margin left" always applied to the left of the container, regardless of writing direction?
Have we considered using a model similar to logical CSS properties so that our layouts are writing direction agnostic? This will interesting especially in the context of multi-language sites.
(excuse my intermission, definitely not blocking for this issue).
I've removed the linked view and the control now defaults to the axial view when available, single side view if that's all that's supported, and the custom view for edge case configurations or when individual sides have mixed values.
The PR still needs some polishing but it is in a state where you can give it a run and get a feel for the new UX.
how do we handle these margins? Ie. is "margin left" always applied to the left of the container, regardless of writing direction?
At this stage, that's how the style engine maps the values to CSS styles, which follows the approach the block supports took originally.
Have we considered using a model similar to logical CSS properties so that our layouts are writing direction agnostic? This will interesting especially in the context of multi-language sites.
Good question. Long term, I'm expecting we will need to move to something like that.
Updating the block supports and style engine to produce the correct styles with logical CSS properties should be pretty straightforward. Manipulating the control's UI to reflect the physical spacing might be a little more involved. I'd expect the style object to remain fairly consistent so with luck the trick would be applying appropriate labels and icons to the individual spacing sizes controls.
This would be a great follow-up to explore so it can be stable before its need becomes more pressing.
Activity
paaljoachim commentedon Mar 22, 2023
Hey James.
That is a very good idea! I like the compact view in the last mockup!
The only thing that comes up is if the controls become too small to handle.
It would be interesting to try out!
richtabor commentedon Mar 23, 2023
I'm curious. What's the thinking on the chunkier tracks?
richtabor commentedon Mar 23, 2023
And for the columns arrangement, what're you thinking for when a custom value is used?
jameskoster commentedon Mar 23, 2023
cbirdsong commentedon Mar 23, 2023
It would really be good if a new design for the slider could solve the unset/inherit/default problem described in #43082 (comment). Would this design also look identical to "none" before it's been modified?
cbirdsong commentedon Mar 23, 2023
Separately and more focused on this specific issue, have you considered arranging them in a + shape to make it very clear what slider is associated with each side?
(Pardon my very quick rearrangement of the screenshot above, the spacing and alignment is definitely sloppy)
jasmussen commentedon Mar 24, 2023
20 remaining items
aaronrobertshaw commentedon May 16, 2023
Thanks for the icons and feedback 👍
I have a draft PR up in #50660. There's still a lot left to polish so take it with a grain of salt.
It also still retains the linked/all sides view for the control. Mainly due to covering the potential for odd side support configurations on custom blocks such as
["top", "right", "bottom" ]. It also keeps the initial footprint to a minimum which seemed in the spirit of this issue but I'm happy to iterate from here.Other than that, I have two further questions;
["top", "bottom"], the axial view ("Vertical") is almost the same as the all sides view.No doubt, I'll have further questions as we iterate but that's about all my brain can handle for today 🙂
jameskoster commentedon May 16, 2023
For me, the hints aren't super useful and just add noise. So I'd be fine with losing them.
Is the sides configuration already built into the control? It seems a bit strange to limit sides for which a user can add/edit padding 🤔 If it is, then yes it probably doesn't make sense to show the option(s) for disabled configs. Apologies if I am misunderstanding the question. FWIW I still lean towards omitting the linked/all sides view. It's quite rare to need equal vertical & horizontal padding.
aaronrobertshaw commentedon May 17, 2023
👍 Sounds like a plan. I'll leave them out.
That is correct. The ability to configure any supported sides from top, right, bottom, left, was added as far back as April 2021. It was extended shortly after that to allow axial sides (horizontal & vertical) to be supported in the block.json sides config.
I agree. There are a couple of blocks that restrict padding to only the axial sides i.e. horizontal & vertical, no support for individual sides. The button block is the primary example there.
It is possible for 3rd party blocks to have configured their sides however they wanted. So any subset of
[ top, right, bottom, left, horizontal, vertical ]The other thing worth noting here is that this same approach to sides configuration applies to all spacing block supports and they all (margin, block gap etc) share this same spacing control.
The current state of #50660 doesn't show any controls for disabled sides. The issue is when only one axial side is supported via
["top", "bottom"], the "linked" view is effectively the same as the "axial" view which would only be showing a single control as well.Screen.Recording.2023-05-17.at.7.08.36.pm.mp4
Regarding the inclusion of the "linked" view, I kept it for the moment as noted to cover a sides configuration that doesn't neatly align with the horizontal and vertical axial views.
A contrived example might be a 3rd party block, using an inner blocks template with a custom child block. It might have that custom child block styled to appear in the top-right corner and they wish to allow the configuration of margin for only the left and bottom sides. (I did say contrived 🙂). In such a situation, I don't think it makes sense to default to the "axial" view.
We could default to the "custom" view containing all the separated controls. Would that be undermining the effort to reduce the footprint of this control? Or is it an edge case we can safely ignore for the time being?
Left, BottomTop, Bottom, LeftScreen.Recording.2023-05-17.at.7.10.53.pm.mp4
Screen.Recording.2023-05-17.at.7.11.56.pm.mp4
I'm happy to iterate on #50660 however you'd like it. I can certainly remove the "linked" view, or we could only include it for those edge case configurations like
[top, bottom, left]etc. where it might be more useful.Thanks for the guidance and direction on this one 🙇
jameskoster commentedon May 17, 2023
In your example, this makes the most sense to me. I don't think it undermines the "reduce the footprint" objective because only the editable sides would be represented, so in this case two controls. It does also feel a bit of an edge case that we can perhaps circle back to.
Thanks for the diligence here, it's a tricky one!
ciampo commentedon May 17, 2023
I have a question that is tangential to this specific PR, but it came to mind while observing the current WIP: for languages with different writing directions (ie. RTL, or even top to bottom), how do we handle these margins? Ie. is "margin left" always applied to the left of the container, regardless of writing direction?
Have we considered using a model similar to logical CSS properties so that our layouts are writing direction agnostic? This will interesting especially in the context of multi-language sites.
(excuse my intermission, definitely not blocking for this issue).
aaronrobertshaw commentedon May 18, 2023
I've removed the linked view and the control now defaults to the axial view when available, single side view if that's all that's supported, and the custom view for edge case configurations or when individual sides have mixed values.
The PR still needs some polishing but it is in a state where you can give it a run and get a feel for the new UX.
Quick demo
Screen.Recording.2023-05-18.at.5.23.20.pm.mp4
At this stage, that's how the style engine maps the values to CSS styles, which follows the approach the block supports took originally.
Good question. Long term, I'm expecting we will need to move to something like that.
Updating the block supports and style engine to produce the correct styles with logical CSS properties should be pretty straightforward. Manipulating the control's UI to reflect the physical spacing might be a little more involved. I'd expect the style object to remain fairly consistent so with luck the trick would be applying appropriate labels and icons to the individual spacing sizes controls.
This would be a great follow-up to explore so it can be stable before its need becomes more pressing.