-
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
TextControl: remove margin overrides and add new opt-in prop (pt 1/2) #47157
Conversation
Size Change: -264 B (0%) Total Size: 1.33 MB
ℹ️ View Unchanged
|
Flaky tests detected in 8076070. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/3917093720
|
fb38e7d
to
d583e11
Compare
@@ -247,6 +247,7 @@ export default function QueryInspectorControls( { | |||
onDeselect={ () => setQuerySearch( '' ) } | |||
> | |||
<TextControl | |||
__nextHasNoMarginBottom |
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.
To note, there is an additional margin override, but it appears to be coming from ToolsPanel
:
margin-bottom: 0; |
expanded={ false } | ||
> | ||
<FlexItem> | ||
<VStack spacing={ 3 }> |
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.
This is one of many, but we could have continued to Flex and Flex Item but it requires more. Also, before, the first Flex/parent> Flex Item/child wasn't affecting the styles. So I thought it would be cleaner to nest an HStack within a VStack for the same effect but with less.
And it looks like it's been discussed before, to move from Flex to VStack/HStack: #43085
@@ -49,10 +49,7 @@ | |||
.edit-post-template-top-area__popover { | |||
.components-popover__content { | |||
min-width: 280px; | |||
|
|||
> div { | |||
padding: 0; |
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.
This wasn't affecting the popover so it appeared to be broken (shared screenshots in testing steps).
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.
Nice catch!
Unrelated to this PR, but just to note some clean ways to resolve these common .components-popover__content
hacks in Dropdown:
padding: 0
— We recently introduced a<DropdownContentWrapper>
that can be used to remove the default padding.min-width
— This style can easily be moved to the element inrenderContent
, thus avoiding a CSS hack.
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.
Thank you for sharing!
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.
Great work as always!
I had a small note about merging the margin-top with the VStack spacing, but otherwise this looks good to go 👍
justify="flex-end" | ||
> | ||
<FlexItem> | ||
<VStack spacing="5"> |
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.
Nice 😎
) } | ||
/> | ||
<HStack | ||
className="edit-site-custom-generic-template__modal-actions" |
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.
Would it be better to remove the margin-top on .edit-site-custom-generic-template__modal-actions
and merge that extra whitespace into the VStack spacing?
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.
Yes, definitely! Nice catch. :)
@@ -49,10 +49,7 @@ | |||
.edit-post-template-top-area__popover { | |||
.components-popover__content { | |||
min-width: 280px; | |||
|
|||
> div { | |||
padding: 0; |
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.
Nice catch!
Unrelated to this PR, but just to note some clean ways to resolve these common .components-popover__content
hacks in Dropdown:
padding: 0
— We recently introduced a<DropdownContentWrapper>
that can be used to remove the default padding.min-width
— This style can easily be moved to the element inrenderContent
, thus avoiding a CSS hack.
8076070
to
62fe52c
Compare
Part 1/2
What?
Added new opt-in prop
__nextHasNoMarginBottom
for usages ofTextControl
in the Gutenberg codebase and removed margin overrides.Why?
Part of this project: #38730
The tl;dr is
BaseControl
has amargin-bottom
which makes it difficult to reuse and results in inconsistent use.How?
By removing margin overrides in the CSS and adding the prop
__nextHasNoMarginBottom
. As well as addingVStack
andHStack
(and sometimes replacingFlex
with those) to remove additional CSS and get the changes visually identical to trunk.Testing Instructions
Block Editor testing steps:
Create a new post and follow testing steps below:
PostSlug
add_post_type_support( 'post', 'slug' );
togutenberg.php
PostURL
! isEditable
to view it: https://github.com/WordPress/gutenberg/blob/fb38e7dbe99669cfc0c569903b34809974f68fc3/packages/editor/src/components/post-url/index.js#L52Link Control
ButtonEdit & withInspectorControl (HTML/CSS fields)
Image
ReusableBlockEdit & ReusableBlockConvertButton
Step 1
Step 3
OrderedListSettings
NavigationLinkEdit & NavigationSubmenuEdit & NavigationMenuNameControl
Step 3
Step 6 and 8
PostFeaturedImageDisplay
PostTermsEdit
QueryInspectorControls
TableEdit
PostTemplateCreateModal & EditTemplateTitle
Before
After
PostPublishPanelPostpublish
Block Editor checklist:
Site Editor testing steps:
AddCustomGenericTemplateModal & RenameMenuItem
Step 5
Step 8
PostTitleEdit
TemplatePartAdvancedControls
Site Editor checklist: