Skip to content
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

Merged
merged 28 commits into from
Apr 3, 2019
Merged

[WIP] EuiSelectable #1699

merged 28 commits into from
Apr 3, 2019

Conversation

cchaos
Copy link
Contributor

@cchaos cchaos commented Mar 7, 2019

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 in mobile
  • This was checked in IE11
  • This was checked in dark mode
  • Any props added have proper autodocs
  • Documentation examples were added
  • A changelog entry exists and is marked appropriately
  • [ ] This was checked for breaking changes and labeled appropriately
  • Jest tests were updated or added to match the most common scenarios
  • This was checked against keyboard-only and screenreader scenarios
  • [ ] This required updates to Framer X components

@cchaos
Copy link
Contributor Author

cchaos commented Mar 7, 2019

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.

@ryankeairns
Copy link
Contributor

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.

@cchaos
Copy link
Contributor Author

cchaos commented Mar 11, 2019

Thanks @ryankeairns

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?

Yeah I need to add some optional props for styling when it is the case of it not being in a container.

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.

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 Option object props, it's because we can't currently import them into the props tab. I have an open issue for it #1688.

@elastic elastic deleted a comment from cchaos Mar 12, 2019
@elastic elastic deleted a comment from cchaos Mar 12, 2019

clearActiveOption = () => {
this.setState({
activeOptionIndex: undefined,
Copy link
Contributor

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)

Copy link
Contributor Author

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?
Copy link
Contributor

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?

Copy link
Contributor Author

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';
Copy link
Contributor

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

Copy link
Contributor Author

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

Copy link
Contributor Author

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 Options 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.

@thompsongl
Copy link
Contributor

Getting back around to looking at this.

General impression is that there needs to be more shared internal components, specifically with EuiComboBox. Just in the time this component has been in the works, there's been divergence due to bugfixes. Were you intendong for that to be part of a later PR or did you see them as entirely separate entities?

@cchaos
Copy link
Contributor Author

cchaos commented Mar 25, 2019

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.

@cchaos
Copy link
Contributor Author

cchaos commented Mar 25, 2019

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.

@thompsongl
Copy link
Contributor

I like that direction:

  1. Beta badge in the docs for now
  2. Follow-up PR that abstracts list & filter logic to share with EuiComboBox, etc., using EuiComboBox as the source of truth (unless this PR can pull in its upstream bugfix changes)

@cchaos
Copy link
Contributor Author

cchaos commented Mar 27, 2019

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.

@chandlerprall
Copy link
Contributor

Hey neat! The I18n token verification works :-D

22:10:53 Token euiComboBoxOptionsList.noAvailableOptions has two differing defaults:
22:10:53 No options available
22:10:53 There aren't any options available

Need to rename the token in selectable.tsx

@thompsongl
Copy link
Contributor

@cchaos @chandlerprall PR to remove prop mutations: cchaos#18

Copy link
Contributor

@snide snide left a 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.

@thompsongl thompsongl mentioned this pull request Apr 1, 2019
9 tasks
src/components/selectable/selectable.tsx Outdated Show resolved Hide resolved
src/components/selectable/selectable.tsx Outdated Show resolved Hide resolved
src/components/selectable/selectable.tsx Show resolved Hide resolved
Copy link
Contributor

@chandlerprall chandlerprall left a 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

Copy link
Contributor

@snide snide left a 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.

@cchaos
Copy link
Contributor Author

cchaos commented Apr 3, 2019

Darn it! I'm getting an error in IE11:

Screen Shot 2019-04-03 at 12 55 11 PM

Screen Shot 2019-04-03 at 12 54 18 PM

Not really sure how to debug, but since it won't even render any of the doc sections I'm wondering if it has to do with the beta badge?

@cchaos
Copy link
Contributor Author

cchaos commented Apr 3, 2019

Nope, not from the beta badge... hmmm

@cchaos cchaos merged commit 26d8686 into elastic:master Apr 3, 2019
@cchaos cchaos deleted the eui-selectable branch July 8, 2019 20:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create a pattern for search within popover
5 participants