-
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
BaseControl: Add box-sizing
resets
#42889
Conversation
Size Change: -45 B (0%) Total Size: 1.27 MB
ℹ️ View Unchanged
|
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.
Thanks for your great work!
✅ I have tried changing the global CSS switcher added in #42747 on Storybook, and I have confirmed the widths and heights are maintained correctly on each component.
✅ The issue reported in #41961 (box-sizing
not applied to input elements in table block placeholders) has been fixed.
I think that the following box-sizing
could also be removed in the BaseControl-based component.
I tried turning box-sizing
on and off in the developer tools, but the layout was maintained correctly on the Storybook.
gutenberg/packages/components/src/select-control/styles/select-control-styles.ts
Line 124 in f46c873
box-sizing: border-box; |
gutenberg/packages/components/src/focal-point-picker/styles/focal-point-picker-style.js
Line 31 in f46c873
box-sizing: border-box; |
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.
Code changes LGTM 🚀
Components tested:
-
CheckboxControl
-
ComboboxControl
-
FocalPointPicker
-
RadioControl
-
RangeControl
-
SearchControl
-
SelectControl
-
TextControl
(fixes width bug) -
TextareaControl
(fixes width bug) -
ToggleControl
-
ToggleGroupControl
(fixes height bug) -
ToolsPanel
Ah sorry, I totally forgot to mention these! 🤦 I left these two intentionally, because they apply to specific tag types (select, img, video) instead of div/span. It is possible that wp-components are used in a CSS environment where there are broadly scoped CSS files similar to |
Thank you for the detailed explanation. |
Part of #42415
Part of #41961
What?
box-sizing
reset to BaseControl. This immediately fixes the box-sizing problems we were seeing in the following components:box-sizing
declarations in components based on BaseControl.Why?
We can't guarantee that the surrounding context has a box-sizing reset in place.
Testing Instructions
npm run storybook:dev
<BaseControl
to see where it's used in the repo, especially in packages other than wp-components. Take a look at the code (or test in wp-env!) to see if there could be problems.✅ I have visually inspected all the BaseControl-based components compared with
trunk
to check for regressions