-
Notifications
You must be signed in to change notification settings - Fork 842
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
Add check mark to singleSelection EuiComboBox #2890
Conversation
Preview documentation changes for this PR: https://eui.elastic.co/pr_2890/ |
@andreadelrio is there any chance I can convince you to wait on merging this until #2838 is in? I'd be happy to rebase this PR for you once #2838 is merged (which, could be tomorrow, maybe? It's pretty close, I think). It'll be much easier to rebase this off of #2838 than to do the reverse. |
@andreadelrio @dimitropoulos I agree that waiting is a good idea. We'll make sure the wait isn't long and that any conflicts are resolved for you |
.euiFilterSelectItem__crossIcon { | ||
visibility: hidden; // hiding cross icon in single selection combo box | ||
} |
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.
@andreadelrio I'm confused by this one. Can you explain why the cross would show up in singleSelection
combo boxes and why it'd be necessary to force hide it?
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.
Whoops, I was overcomplicating things, passing null to checked
was enough. I made the changes.
Preview documentation changes for this PR: https://eui.elastic.co/pr_2890/ |
Talked with @andreadelrio about this and the behavior is a little odd where the icon only shows on the currently focused item, not the currently selected item. She's looking into it. |
@cchaos pushed changes based on your PR I replaced
How things are working now: |
Preview documentation changes for this PR: https://eui.elastic.co/pr_2890/ |
@snide thanks for catching that! Just pushed a fix. |
Ahh I didn't realize the original ternary was from this PR and not from master. 👍 |
Preview documentation changes for this PR: https://eui.elastic.co/pr_2890/ |
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.
Looks great! I tested (Chrome only) in all the docs examples to make sure it works with the different rendering options and it does. Much better experience for single selection. 💯
@andreadelrio Reminder though that we'll want to wait until the TS conversion of EuiComboBox PR #2838 gets merged first before merging this one. |
^ I'm going to merge the TS conversion PR shortly and then resolve any conflicts here |
selectedOptions.length && selectedOptions[0].label === label | ||
? 'on' | ||
: null; | ||
let checked: 'on' | 'off' = 'off'; |
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.
@thompsongl I don't think this is correct. off
would mean the icon shows a cross
instead of no icon. It should be undefined
or on
.
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.
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.
Ah ok. Good catch
Preview documentation changes for this PR: https://eui.elastic.co/pr_2890/ |
Preview documentation changes for this PR: https://eui.elastic.co/pr_2890/ |
Summary
This PR adds a check mark to the
singleSelection
combo box. To do this I enabledshowIcons
inEuiFilterSelectItem
whensingleSelection
is true and hid the cross icon using CSS.renderOption
Fixes #2808
Checklist
- [ ] Check against all themes for compatibility in both light and dark modes- [ ] Checked in mobile- [ ] Props have proper autodocs- [ ] Added documentation examples- [ ] Checked for breaking changes and labeled appropriately- [ ] Checked for accessibility including keyboard-only and screenreader modes