-
Notifications
You must be signed in to change notification settings - Fork 1.2k
[ResourceList] Trunctate long sortOption label #2957
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
@beefchimi this is a possible solution... tested on chrome, firefox & safari
but would love some input 🥬
Uh oh!
There was an error while loading. Please reload this page.
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.
Okay, so this can actually be fixed rather easily 😄
You can replace ALL of your changed code in this file with:
That is the most simple solution. Two things to potentially alter:
1. Apply "layout fix" to all children
Personally, I would apply that
layout-flex-fixmixin to ALLchildrenof.HeaderContentWrapper. So, you could instead do:2. Try to avoid reaching into other components to override styles
The
> *selector is specifically targeting the.Labelleddirect child. It would be preferable if we did not have to apply this snowflake override style... so I'm wondering ifmax-width: 100%can live comfortably on the.Labelledselector withinLabelled.scss. I think its worth experimenting with that change to see if it causes issues any where else<Labelled />is used.Explanation
We need to utilize this
layout-flex-fixmixin on direct children ("flex items") of adisplay: flexparent in order to get truncation to work correctly. This is a very common problem/solution! All that mixin is doing is applying the following styles:This seems... silly, because those prop + values seem obvious and should be default behaviour.... right?!?! The short answer is: flex box items will not shrink below their minimum content size. So, if the minimum content size is computed as the full width of a sentence, it cannot be below that width in order to truncate. In comes out handy "flex fix" styling to say "well actually min-width can be
0".For a better explanation, our very own @dfmcphee wrote a blog post on it!
https://dfmcphee.com/flex-items-and-min-width-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.
thanks so much @beefchimi! really appreciate that.
fyi for posterity's sake:
adding the

max-width: 100%on the.Labelledselector inLabelled.scssresults in:adding the

@include layout-flex-fix;to all children of.HeaderContentWrapperresults in:so i'm going with your very fist suggestion. thanks again for your input!
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.
We could improve this further with some tweaks to the other
HeaderContentWrapper, mainly to thatSelectWrapperso that it has amin-widthof at least the:widthof acheckbox+spacing()But just so other reviews know - the label of that "select checkbox" will truncate as well. Its just that Caroline's example is soooo long that it goes beyond the text label and starts encroaching onto the
checkboxinput. Realistically, we probably wouldn't end up in the scenario.@carolopolo would you mind opening an issue with your 2nd screenshot to track this? You can link to this comment + include any relevant context.