-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
More SelectMenu improvements #922
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--check
TODO on dotcom:
SelectMenu-icon--check
to 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-list
to filter, the DOM nodes get removed, but for the branch pickerdisplay: none
is used. This has the effect that:first/:last-child
can't be used anymore.Fix: Use a
bottom-border
and thenmargin-bottom: -1px
on the list to hide the "last" border fb3a10aUsing
box-shadow
would 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-height
a bit. 279c87e3. Introduce
.SelectMenu-icon--check
Currently we use the
SelectMenu-icon
class 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-icon
more generic. It only cares about the size and margin and can be used for any icon..SelectMenu-icon--check
modifier 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--checked
might be confused for adding a state.SelectMenu-icon--selected
same.SelectMenu--showWhenChecked
could be used for anything, not just icons. People might expect it to bedisplay: none
by 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-0
can be used, but might be convenient to "bake that in".