-
Notifications
You must be signed in to change notification settings - Fork 843
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
[WIP] EuiSelectable #1699
[WIP] EuiSelectable #1699
Conversation
What I really need on this is engineering support to comb through the TS defs and such. @chandlerprall and/or @thompsongl There is no rush on this, but I'd really like your support on this. You can push directly to the branch and/or make PR's against mine to clean up anything you see. I think that this might be an ever-evolving component with added features, as has the combo box been, but in essence most of the option object manipulation like putting selected options first, should be done by the consumer. We can possible add helpers for it, but should not be the job of the component. It should be mostly dumb. I know I still have some design cleanup to do, but would also love some visual feedback from @ryankeairns and/or @snide. |
This is really nice! I have just one general design question... Is this intended to be used in a standalone fashion (i.e. in open space) or only within a container such as a popover or flyout? If the former is a potential use case, then additional styling might need to be considered. For example, the flyout example has the search input contained in separate section and uses the shadow along its bottom edge which provides some nice separation and affordance for scrolling. On the contrary, the examples in the docs feel a bit tight between the search input and the list of items. With regards to the docs, the page struck me as being rather text-heavy and the use of bold and bulleted text felt uncommon. Perhaps some of that content could be trimmed/moved to Props tab/placed in a callout, etc. |
Thanks @ryankeairns
Yeah I need to add some optional props for styling when it is the case of it not being in a container.
Can you give some more concrete examples? Or feel free to point them out directly in the code review. If you are also specifically talking about that first block where I write out the |
|
||
clearActiveOption = () => { | ||
this.setState({ | ||
activeOptionIndex: undefined, |
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 like some things in this file are now out of date with how EuiComboBox works (since #1695)
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.
Has there been any fixes to EuiComboBox, that you think are needed in EuiSelectable?
|
||
case TAB: | ||
// Disallow tabbing when the user is navigating the options. | ||
// TODO: Can we force the tab to the next sibling element? |
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.
When this.hasActiveOption()
is true
or false
?
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.
So right now there's a weird behavior between tabbing and using the arrow keys to navigate the items.
The following gif starts with tabbing, then when it reaches Iapetus
, the arrow keys are used to navigate
My thoughts would be that you tab to focus in and out of the whole list and then only the arrow keys allow for navigating the list.
// @ts-ignore | ||
import { EuiLoadingChart } from '../loading'; | ||
// @ts-ignore | ||
import { getMatchingOptions } from '../combo_box/matching_options'; |
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 should probably be pulled out of combo_box
and moved to services
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.
I'll look into generalizing that into a service
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.
I couldn't completely generalize it into a global service because it was depending on there being an item.label
so I just set the types to be Option
s and Option[]
and put a version of it in the selectable folder. This still means that EuiComboBox has it's own matching_options
function, but I did that on purpose again because that conversion will be at a later date.
Getting back around to looking at this. General impression is that there needs to be more shared internal components, specifically with |
In a separate PR, we can try to replace the EuiComboBox parts (and some of the FilterGroup parts), but that might make this too gigantic. I'd rather make sure this component works on it's own first. |
We can put a "beta" label on it for now, until we are able to peicemeal it off with EuiComboBox. That way if we need to make breaking changes to it in order to make it work with EuiComboBox, we've set that expectation. |
I like that direction:
|
I added the beta badge to the docs and I think I'm done with all the options. I'm going to start filling out the tests now. So 👍 or specific code review fixes would be appreciated. |
Hey neat! The I18n token verification works :-D
Need to rename the token in selectable.tsx |
@cchaos @chandlerprall PR to remove prop mutations: cchaos#18 |
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.
Did some accessibility checks with screen readers and it's got some hiccups. I'll put together a PR to see what I can fix.
src/components/selectable/selectable_search/selectable_search.tsx
Outdated
Show resolved
Hide resolved
src/components/selectable/selectable_search/selectable_search.tsx
Outdated
Show resolved
Hide resolved
src/components/selectable/selectable_search/selectable_search.tsx
Outdated
Show resolved
Hide resolved
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.
Needs a changelog 😀
LGTM
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.
I've added #1789 to document the issues I noticed with accessibility. I don't want that to hold up this PR (since it's been around awhile with a lot of work in it) since it's a beta PR and things mostly work. I have a branch running that I'll continue with and get a patch going this week.
- Fixed single selection (mostly) - Fixed on Enter of first item - Removed `selectedOptions` where unnecessary - Fixed defaultValue passed to search - Added `append` and `prepend` to Option type - Fixed `…listProps`
and icon type TS issue
This reverts commit ae9e3bd.
Nope, not from the beta badge... hmmm |
Summary
The idea behind this new component is to generalize a selectable (and searchable) list of objects that can be used anywhere and will remain consistent across usages.
I've throughly documented it in the component props and the docs pages. So please pull down the branch to walk through it (or read the files).
Essentially it can look like:
This should also fix #1498 by providing the pattern than can be added to any container including a popover.
Checklist
[ ] This was checked for breaking changes and labeled appropriately[ ] This required updates to Framer X components