-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Normalize block inspector controls spacing #64526
Changes from 5 commits
58014a8
4132ac4
0e27c79
9c0a29f
7939750
5dcdcbd
a758f2d
67b9a1a
865c053
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,7 +26,7 @@ | |
} | ||
|
||
&.is-opened { | ||
padding: $grid-unit-20; | ||
padding: $grid-unit-20 $grid-unit-20 #{$grid-unit-20 + $grid-unit-05} $grid-unit-20; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Appreciate it's out of scope but do you know why is the bottom padding larger than the rest? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm assuming it was meant as an optical adjustment (see also #64526 (comment)). We can easily remove the larger bottom padding as part of this PR if the design team prefers that. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It seems unnecessary to me, and doesn't feature in the specs. I don't have the full history but would lean towards removing it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. FWIW this felt weird when reviewing it. If there's no good reason to have it, let's use the opportunity to remove it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
} | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am assuming this style on
:last-child
was an intentional optical adjustment (if not, it would've beenmargin-bottom: 0
).I think we should move this optical adjustment to the padding on the containers, i.e.
PanelBody
andToolsPanel
. It would be less hacky, and apply more universally (for example if the last control in the container was not wrapped in aBaseControl
).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While we work on this, could we also find a way to move away from using
.components-base-control
at all?Apart from the fact that is a private API of the components package and that it makes the UI fragile to future changes, it also doesn't work for controls that are not wrapped in base control.
Maybe we can introduce a
block-editor
package-specific classname instead (ie.block-editor-inspector-controls__control
or something) and apply it where relevant? Or switch toVStack
or similar, where the vertical spacing is defined on the parent and not the children?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The pathway I have in mind at the moment is:
__next
prop 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 onInspectorControls
and not on any@wordpress/components
components.spacing
is 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.Another long journey 😇
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extracted to a tracking issue: #65191
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be built into the component? Should these panels consume DataForms?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can consider it, for example making the container component a flexbox with a 16px gap. Not immediately sure if that would be too restrictive though.
Hmm, interesting. @oandregal Are they meant for the block inspector at all? My first impression is that it could be used for some cases, but it wouldn't cover everything.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I presume any place that uses a complex form is a potential consumer of DataForm. I don't think it is ready for replacing inspector controls yet.