-
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
Components: Update the TextControl padding to match the rest of the controls #64326
Conversation
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. |
9f68024
to
90bac52
Compare
This seems to create some inconsistency in different UIs (block padding/margin controls, border radius and border...) I wonder if the right fix is the opposite (use the smaller padding for all controls). |
Size Change: +7 B (0%) Total Size: 1.77 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.
For those viusal changes, it's worth providing some before/after screenshots just in case.
Also, might make sense to test all affected instances across the editor in addition to the one pointed out in testing instructions.
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.
There is also some consistency work to be done on TextareaControl, so I'll do that separately.
padding-inline-start: $grid-unit-20 - 1px; | ||
padding-inline-end: $grid-unit-20 - 1px; |
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.
Subtracting 1px to account for the fact that the newer components do not include a border on the underlying element. Also tweaked to use logical properties (though it doesn't really matter here), since we'll likely start linting for that in this package.
Temporary story diff for testing:
diff --git a/packages/components/src/input-control/stories/index.story.tsx b/packages/components/src/input-control/stories/index.story.tsx
index 6067c467f9..0b3353e0c7 100644
--- a/packages/components/src/input-control/stories/index.story.tsx
+++ b/packages/components/src/input-control/stories/index.story.tsx
@@ -14,6 +14,9 @@ import InputControl from '..';
import { InputControlPrefixWrapper } from '../input-prefix-wrapper';
import { InputControlSuffixWrapper } from '../input-suffix-wrapper';
import Button from '../../button';
+import TextControl from '../../text-control';
+import SelectControl from '../../select-control';
+import { VStack } from '../../v-stack';
const meta: Meta< typeof InputControl > = {
title: 'Components (Experimental)/InputControl',
@@ -112,3 +115,23 @@ export const ShowPassword: StoryFn< typeof InputControl > = ( args ) => {
/>
);
};
+
+export const SizeTest = {
+ render: () => {
+ return (
+ <VStack spacing={ 2 }>
+ <InputControl __next40pxDefaultSize value="Hello" />
+ <TextControl
+ __nextHasNoMarginBottom
+ __next40pxDefaultSize
+ value="Hello"
+ onChange={ () => null }
+ />
+ <SelectControl
+ __next40pxDefaultSize
+ options={ [ { label: 'Hello', value: 'hello' } ] }
+ />
+ </VStack>
+ );
+ },
+};
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.
What's the difference between InputControl
and TextControl
?
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.
Should we add a comment to explain the need for subtracting 1px?
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.
What's the difference between
InputControl
andTextControl
?
InputControl
is newer, still formally experimental, and has a few more features that TextControl
doesn't - like prefix, suffix, and additional ways to display the label. Check the storybook stories to get a better idea.
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.
InputControl is newer, still formally experimental, and has a few more features that TextControl doesn't - like prefix, suffix, and additional ways to display the label. Check the storybook stories to get a better idea.
Why didn't we just update TextControl with the new features (and new implementation)
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.
Comment added in 829e082
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 wasn't part of the team back then, but IIRC InputControl
came along with G2, and was aiming to be TextControl
's successor. My assumption is that we preferred a new component in order to supply all the new features (including making it themeable) without breaking any backwards compatibility. It was also intended for those 2 components to converge, but it never happened. It might be something to pursue at some point, and it's possible that others might have thought about it already (@WordPress/gutenberg-components)
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 converging could've happened as part of #59418, but due to the Emotion performance issues we found in #58948 (comment), I'd want to wait until we remove Emotion from InputControl. It is definitely in the plans though, since it doesn't make sense to have two input components in the package.
decf231
to
96382a5
Compare
Related #57394
What?
I noticed that the TextControl component has a different padding than Number and Select controls (when used with the 40px size). This PR tries to fix that.
I'm not entirely sure that this PR fixes all the cases raised in the issue above, it only focuses on TextControl.
Why?
Consistency of the design system.
Testing Instructions
npm run storybook:dev