-
Notifications
You must be signed in to change notification settings - Fork 1.3k
More SelectMenu improvements #922
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
|
This pull request is being automatically deployed with ZEIT Now (learn more). 🔍 Inspect: https://zeit.co/primer/primer-css/1uyech6h7 |
7194e2d to
851a70a
Compare
This is re-applying the later reverted changes from #900
af24fe6 to
2c8afda
Compare
|
FYI: While resolving merge conflicts, I also added the changes from #965 into this branch. I think this should now be ready. |
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.
This looks great. Thanks for working through all these issues!
This adds a few more improvements to the
.SelectMenu.TODO:
.SelectMenu-icon--checkTODO on dotcom:
SelectMenu-icon--checkto all check icons.While testing the SelectMenu for the "branch picker" more issues came up:
1. When filtering, a top border is visible
When using
fuzzy-listto filter, the DOM nodes get removed, but for the branch pickerdisplay: noneis used. This has the effect that:first/:last-childcan't be used anymore.Fix: Use a
bottom-borderand thenmargin-bottom: -1pxon the list to hide the "last" border fb3a10aUsing
box-shadowwould be an alternative because it gets cut off withinoverflow-y: auto;. But it seems scrolling performance suffers.2. The branch list is not as tall
Fix: Increase
max-heighta bit. 279c87e3. Introduce
.SelectMenu-icon--checkCurrently we use the
SelectMenu-iconclass specifically for the check icon to show if an item is selected or not. But there have been cases where a SelectMenu uses different icons unrelated to the selected/checked state. This PR:.SelectMenu-iconmore generic. It only cares about the size and margin and can be used for any icon..SelectMenu-icon--checkmodifier class that toggles based on thearia-checked="true"attribute.Above markup renders as:
It allows to mix check and other icons in the same list and have them aligned without fiddling with margin utilities.
Alternatives
Some alternative names instead of
SelectMenu-icon--check:.SelectMenu-icon--checkedmight be confused for adding a state.SelectMenu-icon--selectedsame.SelectMenu--showWhenCheckedcould be used for anything, not just icons. People might expect it to bedisplay: noneby default, instead ofvisibility: hidden. But that would make the text jump.4. Prevent shrinking of the icon
Happens when the text starts to wrap, see #961. A
flex-shrink-0can be used, but might be convenient to "bake that in".