-
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
Search Block: Fix unintended wrapping of button text in "Button only" style #53373
Conversation
Size Change: +87 B (0%) Total Size: 1.44 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.
Thank you for yet another fantastic PR, this one should land, but I'd love a review by some of the folks who worked on this feature, perhaps @jffng ?
// Prevent unintended text wrapping. | ||
flex-shrink: 0; | ||
// Ensure minimum input field width in small viewports. | ||
max-width: calc(100% - 100px); |
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.
Can you elaborate on how this calc math works? What are those 100px meant to capture? Is it the width of the confirm-button?
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 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.
Sounds good to me.
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 @t-hamano for the fix. The approach makes sense to me and works as described — the button text does not wrap, until the input cannot shrink any further (the minimum width of 100px).
Thanks for the review, @jasmussen, @jffng! |
Fixes: #53297
What?
This PR fixes an unintentional wrapping of button text when opening and closing input fields when the Search block is "Button only" style.
e51464276e234e6c3eb9463785a665d7.mp4
Why?
The input field and the button are both children of the Flex layout. And since the input field has
fiex-basis:100%
applied, the width of the button is squashed.How?
The fact that the input field extends as far as possible to the full width of the parent element is itself an expected behavior. However, to prevent unnecessary button text wrapping, I applied the following styles to the button:
flex-shrink: 0;
to prevent text wrappingmax-width: calc(100% - 100px);
to prevent button overflow and to ensure minimum width of input fieldsTesting Instructions
Screenshots or screencast
f1659ea8fcd90e3cdae1670e6e4593c2.mp4