Conversation
|
This pull request is automatically deployed with Now. |
So that any icon can be used.
|
The CSS doesn't seem to support native checkbox inputs out of the box. Could we support something like: <label class="SelectMenu-item">
<input type="checkbox">
<%= octicon "check", class: "SelectMenu-icon" %>
Check this out
</label>and then style it with: .SelectMenu-item {
input[type=checkbox] { display: none; }
.SelectMenu-icon ~ input[type=checkbox] { visibility: hidden; }
.SelectMenu-icon ~ input[type=checkbox]:checked { visibility: visible; }
}Or is that too clever? 🤔 |
Yeah, that would be clever. 🤓 On .com we sometimes do use the details-menu element with <div class="SelectMenu-list">
<label class="SelectMenu-item" role="menuitemradio" aria-checked="<%= type_filter.to_s == value %>" tabindex="0">
<%= radio_button_tag "type", value, type_filter.to_s == value, class: "d-none", "data-autosubmit": "true" %>
<%= octicon("check", class: "SelectMenu-icon") %>
<span class="text-normal" data-menu-button-text><%= name %></span>
</label>
</div>Is that ok too? It would leave us the option to also style the |
FWIW in However, I think it isn't necessary to support the But I do think it'd be good to support a CSS class checked state alternative. It'd be useful when .SelectMenu-item[aria-checked="true"],
.SelectMenu-item.SelectMenu-item--checked {
...
} |
That makes sense to me, but I wonder if we can do it with other ARIA attributes, e.g. In other words: Would we only use |
|
@shawnbot That makes sense to me. We can revisit if/when a pressing use case comes up. |
Sounds good. An additional |
|
Yeah I think that is also a case to revisit if/when we need them. |
This is an alternative to #801. It introduces a responsive
.SelectMenucomponent to Primer.Markup
Below a simple example, more options in the documentation.
Modifiers
By default, when the viewport is smaller than
sm, the Select Menu has an auto-height and is vertically centered. If the Select Menu has a filter, the.SelectMenu--hasFiltermodifier can be added to make the Select Menu stick to the top and have a fixed height. This allows the list to be filtered without the input jumping around.xssm.SelectMenu--hasFilterMust have
aria/roleattributesNice to have
border-radius/overflow: autoissue in Safari iOS. -> It works by addingoverflow: hiddenon a parent (.SelectMenu-modal) element.:last-childpseudo selector can't really be used because sometimes the last element gets hidden but remains in the DOM. And the.last-visibleclass is deprecated. Or an<div class="sr-only" data-filterable-notice="" aria-live="polite">10 results found.</div>element gets added as last element. -> ☝️ Above fix also fixed this. Now all child elements should get "masked" with rounded corners. Downside: Overflowing content is no possible anymore. Let's see if we need it.idis needed to make thedata-toggle-forwork for the close button. Should be fine in some cases, but could also become more complex when a Select Menu gets used multiple times on the same page and a unique ID needs to be passed from a parent of the partial. Would be great if<details-menu>would have an equivalent todata-close-dialogthat doesn't require a unique ID..SelectMenuAND the current.select-menuwill be aroundfor a whileforever 🙃, both select menus should look and behave similar. They are currently pretty close, but when taking a closer look, there are still some details that are different..com tests
Issues/PR->wontfix(for now). These are a lot more complex and probably need custom CSS, changes to JS and ERB partials.Ref. https://github.com/github/design-systems/issues/601#issuecomment-489551559