-
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
ComboboxControl: Add lint rule for 40px size prop usage #64560
Conversation
Size Change: +309 B (+0.02%) Total Size: 1.77 MB
ℹ️ View Unchanged
|
@@ -33,6 +33,7 @@ function UserControl( { value, onChange } ) { | |||
|
|||
return ( | |||
<ComboboxControl | |||
__next40pxDefaultSize |
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.
{ showAuthorControl && | ||
( ( showCombobox && ( | ||
<ComboboxControl | ||
__next40pxDefaultSize |
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 spacing gets messed up when a ComboboxControl enters the mix, because it has an additional div wrapper outside the BaseControl. The auto margin added to BaseControls by the block inspector interprets this as a :last-child
BaseControl, and adds a smaller margin.
So here we add a VStack
to explicitly handle our spacing, with the correct metrics (16px gap), and additional CSS to counteract the auto margins. Painful 😭 FYI I am working on this in #64526.
Before | After |
---|---|
Looks like this when showCombobox === false
:
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.
Painful
:hug:
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
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.
🚀
@@ -66,5 +66,6 @@ | |||
"clientNavigation": true | |||
} | |||
}, | |||
"editorStyle": "wp-block-post-author-editor", |
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.
Why is this change needed?
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.
It's necessary because we're readding the editor style file and we want it to be taken into consideration when previewing the blocks in the editor.
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.
@@ -66,5 +66,6 @@ | |||
"clientNavigation": true | |||
} | |||
}, | |||
"editorStyle": "wp-block-post-author-editor", |
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.
It's necessary because we're readding the editor style file and we want it to be taken into consideration when previewing the blocks in the editor.
Flaky tests detected in 563439d. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/10424509480
|
Mmm, thanks for excavating that. I read through the thread and they just removed the editor styles because they realized that the existing styles were duplicated in the main |
Part of #63871
What?
Add a lint rule to prevent people from introducing new usages of ComboboxControl that do not adhere to the new default size.
Testing Instructions
The lint error should trigger for violations as expected.