-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Migrate from TextControl to InputControl to remove margin overrides #47161
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
Conversation
Size Change: -144 B (0%) Total Size: 1.33 MB
ℹ️ View Unchanged
|
Flaky tests detected in b9a817e. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/3917779508
|
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.
Ah, this is a hard one 😅 (Related: #41961)
To share some context:
Placeholder
itself has some very shaky CSS foundations. So this is a can of worms to start with.- We will be retiring the
__next36pxDefaultSize
prop (#46741). But that's ok, we can still use it here for the time being as a clean fix. We'll need to revisit these blocks when transitioning to the new size scheme anyway. - As for the wrapping behavior, we need to think about consistency across the Block Library, which has other blocks with this kind of responsive input & button wrapping (
core/embed
orcore/table
).
tl;dr — I think we should keep the wrapping behavior, so this PR can just remain a clean bug fix and not an entry point into a Placeholder overhaul rabbit hole 🙃 We can still do it cleanly with the HStack by enabling the wrap
prop, and setting a min-width: 80%
or something like that to the InputControl.
What do you think?
<Button variant="primary" type="submit"> | ||
{ __( 'Use URL' ) } | ||
</Button> | ||
<HStack align="baseline"> |
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 the align baseline?
Thank you for the context! This is a good lesson for me; I need to search GH a bit more thoroughly before I go down these rabbit holes... but I figured if it wasn't something we could do, I would at least learn from it! 😅
This is a great idea! I guess this whole PR is a bit of an odd in-between step, but hopefully, it is helpful to have the small fix in the meantime. |
b9a817e
to
6696644
Compare
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, I really appreciate the initiative to fix visual regressions in cleaner ways! 💯
What?
Updated
TextControl
toInputControl
component for RSS block.Why?
While working on this project to remove margin overrides, I found that moving this to InputControl required less CSS. It is also the plan to replace TextControl with InputControl per the storybook docs.
How?
By adding InputControl and HStack to remove CSS overrides.
Testing Instructions
Additional Notes
Before the changes, if the screen size was smaller, the input wouldn't match the button size (fixed in this PR):
However, the button would also move below the input on smaller screen sizes. Should it be below like in trunk?