-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Fix country selector text overflow issue #8125
Conversation
Hey @Devessier, what do you think about this? |
Hey @BKM14, thank you very much for your contribution. I made some changes to minimize the number of files that were changed. These files are often used across the application, and we can easily break something if we make a mistake. |
Yeah, I knew it was a little shabby given the number of files I had to change. I spent a whole day breaking my head trying to fix this. Glad you minimized the changes. |
</StyledControlLabel> | ||
</StyledIconContainer> | ||
) : null} | ||
<StyledLabel>{selectedOption.label}</StyledLabel> |
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.
would it make sense to use OverflowingTextWithTooltipe here?
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.
Done! It works great. However, I'm not sure how accessible using this component here is.
`; | ||
|
||
const StyledIconChevronDown = styled(IconChevronDown)<{ | ||
disabled?: boolean; | ||
}>` | ||
color: ${({ disabled, theme }) => | ||
disabled ? theme.font.color.extraLight : theme.font.color.tertiary}; | ||
flex-shrink: 0; |
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.
are all these flex-shrink mandatory? looks a bit too much everywhere
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 cleaned the layouting by using a unified grid layout.
`; | ||
|
||
const StyledLabel = styled.span` | ||
flex-grow: 1; |
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.
is this flex-grow necessary?
This code looks very similar to OverflowingTextWithTooltip
Thank you a lot for your time, @BKM14. I know truncating text can be tricky. The root issue was that the modal had no max-width, making it hard to truncate text, which requires setting a max-width beyond which the text should be truncated. |
Awarding BKM14: 150 points 🕹️ Well done! Check out your new contribution on oss.gg/BKM14 |
Fixes: ![image](https://github.com/user-attachments/assets/900596ed-1426-49cd-a2f3-4b81eacbb7d0) The regression is due a recent change I made to the SelectControl component: #8125. The SelectControls get applied `text-align: center` due to the styles `react-datepicker` applies to the header component. My grid implementation makes the label take all the available width. I could have let it take an `auto` width, but I think it's better to set the `text-align` property and ensure the `SelectControl` component behaves predictably.
Closes #7906
Modified the two children(
TextInputV2
andCountrySelect
) in theStyledHalfRowContainer
component to always be equal in size and divide the available space equally.The
StyledIconChevronDown
component has aflex-shrink: 0
to prevent it from completely disappearing. The same applies for theselectedOption.Icon
.A
p
tag had to be added to the label to correctly handle the text overflow.