Skip to content
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

Block Inspector: Deprecate bottom margin on BaseControl components #65191

Open
1 of 5 tasks
mirka opened this issue Sep 10, 2024 · 0 comments
Open
1 of 5 tasks

Block Inspector: Deprecate bottom margin on BaseControl components #65191

mirka opened this issue Sep 10, 2024 · 0 comments
Assignees
Labels
[Package] Block editor /packages/block-editor [Type] Enhancement A suggestion for improvement. [Type] Tracking Issue Tactical breakdown of efforts across the codebase and/or tied to Overview issues.

Comments

@mirka
Copy link
Member

mirka commented Sep 10, 2024

What problem does this address?

The block inspector currently sets a margin bottom on all BaseControl components.

.components-base-control {
margin-bottom: #{ $grid-unit-30 };
&:last-child {
margin-bottom: $grid-unit-10;
}
}

This was probably convenient at the time, when flexbox was yet to be widely available. Now, it is hindering our ability to use modern layout methods like flex and grid. And devs are going to need a way to space out elements that are not BaseControl-based anyway.

Some consumers are forced to override the margin added by the block inspector so they can handle their own layout:

.wp-block-search__inspector-controls {
.components-base-control {
// Counteract the margin added by the block inspector.
margin-bottom: 0;
}
}

What is your proposed solution?

The pathway I have in mind at the moment is:

  • Normalize the bottom margins. Normalize block inspector controls spacing #64526
  • Add a __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 on InspectorControls and not on any @wordpress/components components.
  • Figure out a standard way we can recommend to WP devs for spacing out their inspector controls. Is it VStack (not ideal because the current default 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.
  • Migrate everything in the codebase.
  • Deprecate the automatic margin-bottom on BaseControl.
@mirka mirka added [Type] Enhancement A suggestion for improvement. [Type] Tracking Issue Tactical breakdown of efforts across the codebase and/or tied to Overview issues. labels Sep 10, 2024
@mirka mirka self-assigned this Sep 10, 2024
@skorasaurus skorasaurus added the [Package] Components /packages/components label Nov 13, 2024
@mirka mirka added [Package] Block editor /packages/block-editor and removed [Package] Components /packages/components labels Nov 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Package] Block editor /packages/block-editor [Type] Enhancement A suggestion for improvement. [Type] Tracking Issue Tactical breakdown of efforts across the codebase and/or tied to Overview issues.
Projects
None yet
Development

No branches or pull requests

2 participants