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

[Feature Branch] EuiSelectable accessibility #3169

Merged
merged 16 commits into from
Jul 7, 2020
Merged

Conversation

myasonik
Copy link
Contributor

@myasonik myasonik commented Mar 25, 2020

Closes #1789 and closes #2200

PRs

  1. [Feature / Selectable A11y] Improve basic use case a11y #3070
    • swap react-virtualize for react-window and react-virtualized-auto-sizer
    • improve basic use case a11y
    • update prop names on EuiSelectableOptionsList (breaking change 1)
  2. [Feature / Selectable A11y] making EuiSelectable[searchable] more accessible #3234
    • improves accessibility of searchable use case
    • update prop names on EuiSelectableSearch and EuiSelectableList (breaking change 2 and 3)
  3. Remove react-virtualized from ComboBox #3173
    • swap react-virtualize for react-window in EuiComboBox to completetly remove react-virtualized
  4. Misc cleanup after resurecting #3570
    • resurrection! (Fixed some bugs, tweaked some docs, added it to a11y tests)
  5. More aria attributes for Selectable #3583
    • Adds aria-setsize and aria-posinset attributes to options
    • Adds aria-describedby for messages
    • Adds setActiveOptionIndex prop to EuiSelectableList (breaking change 4)
  6. [EuiSelectable] Adding more keyboard shortcuts and screen reader instructions #3620
    • Adds Home, End and Space shortcuts
    • Adds aria-label instructions for exclusions
  7. [EuiSelectable] Focus option after search value change #3670
    • Fixed bugs with setting focus

Breaking changes

  1. virtualizedProps on EuiSelectableOptionsList renamed to windowProps which is now passed into react-window instead of react-virtualized
  2. Removed rootId and added makeOptionId and listId to EuiSelectableList
  3. Added listId to EuiSelectableSearch
  4. Added setActiveOptionIndex to EuiSelectableList
  5. options passed into EuiSelectable cannot have an id
  6. Requires an onChange to be passed into EuiSelectableSearch

Future TODOs

Checklist

  • Check against all themes for compatibility in both light and dark modes
    • Just checked focus states, don't think there's much more to check
  • Checked in mobile
    • Has some oddities with focus states, but everything works
  • Checked in Firefox, Safari, Chrome/Edge
  • Props have proper autodocs
  • Added documentation examples
    • Nothing changed from the consumer side other than props which the autodocs take care of
  • Added or updated jest tests
    • Updated tests to pass (mostly prop changes) though didn't add new ones. (Granted, tests were/are pretty weak right now.)
  • Checked for breaking changes and labeled appropriately
  • Checked for accessibility including keyboard-only and screenreader modes
  • A changelog entry exists and is marked appropriately

* swap react-virtualize for react-window and react-virtualized-auto-sizer
* improve basic use case a11y
* update prop names
@myasonik myasonik changed the title [Feature / Selectable A11y] Improve basic use case a11y (#3070) [Feature Branch] EuiSelectable Mar 25, 2020
@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_3169/

1 similar comment
@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_3169/

@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_3169/

@cchaos cchaos changed the title [Feature Branch] EuiSelectable [Feature Branch] EuiSelectable acessibility Apr 3, 2020
@cchaos cchaos changed the title [Feature Branch] EuiSelectable acessibility [Feature Branch] EuiSelectable accessibility Apr 3, 2020
…essible (#3234)

* Moves many aria-* props from the List<ul> and onto the <input /> or surrounding <div>
* [Breaking] EuiSelectableSearch has 2 new required props and EuiSelectableList has 1
@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_3169/

@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_3169/

@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_3169/

@myasonik myasonik mentioned this pull request Jun 5, 2020
4 tasks
@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_3169/

Co-authored-by: Greg Thompson <thompson.glowe@gmail.com>
@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_3169/

@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_3169/

@myasonik myasonik marked this pull request as ready for review June 18, 2020 21:05
@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_3169/

Copy link
Contributor

@cchaos cchaos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keyboard shortcuts are awesome! With all the work that has gone into the EuiSelectable component itself, is the hope that we can just re-use this in EuiComboBox instead of re-doing all the work in there? I do see you made some edits to combobox but it doesn't have the full features like the keyboard shortcuts.

The only thing I felt odd in the functionality was when the list was filtered down from the search box, and an option is selected it loses focus where as it would normally stay focused.

package.json Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
@cchaos
Copy link
Contributor

cchaos commented Jun 26, 2020

To comment on of your todos:

New rendering type (popover) to support search use case and to begin to bridge gap into supporting combobox/selectable/etc

I'd really rather not tie this component to other specific components. I like the flexibility of being able to place the list and the search box where they need to be. We can absolutely ensure that our examples work appropriately with screen-readers, but I don't think it should be part of the component.

Co-authored-by: Caroline Horn <549577+cchaos@users.noreply.github.com>
@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_3169/

@myasonik
Copy link
Contributor Author

myasonik commented Jun 29, 2020

@cchaos I rephrased that TODO to be vaguer. We can either bring the combobox/filtergroup/etc patterns into Selectable or rework those components to use Selectable under the hood. Either way works, I just wrote down my preference/what I thought would be less work.

I like the flexibility of being able to place the list and the search box where they need to be.

Is this something we have today? Because that's not something I see on the demo page and isn't something I've tested.

@cchaos
Copy link
Contributor

cchaos commented Jun 29, 2020

Is this something we have today?

Kind of but not quite. It's more that they both live in a popover. Or like the Flyout example has the input in the header and the list in the body. But this is how I setup the search in the K8 POC (need to get it back up and running) but you can see the code here: https://github.com/cchaos/kibana-8-nav/blob/master/src/components/kibana/chrome/search/search.tsx

@myasonik
Copy link
Contributor Author

Ah... I didn't think through the possibility of passing in not the list in there... I haven't tested that but I think it should "just work"... If it doesn't, it shouldn't be much work to fix, and shouldn't be a breaking change either, so I'd still like to merge this as is as it's already quite large and getting old.

Also, a note for anyone doing any testing on this, the support is a little mixed on Mac so I defaulted to the best practices/spec suggestions often. Searchable Selectables work best in VO+Safari, but list Selectables work best in VO+Chrome. This is another one of those components I'll want to test in Windows at some point soon before doing more work on polishing.

@cchaos
Copy link
Contributor

cchaos commented Jun 29, 2020

Yep, we can followup with that particular use case which will most likely be on the consuming side (pattern). Can you update the checklist with items you've completed?

@myasonik
Copy link
Contributor Author

Just wanted to talk about the screen reader experience a little more because listboxes and comboboxes (what Selectable is called in ARIA) are tricky components.

Testing this PR in VoiceOver may seem like it yields some mixed results:

  1. Safari and Chromium experiences diverge
  2. Tabbing does less in this PR than what's on the main branch

The reason for both of those is because it more closely aligns to what's in the aria spec. The spec enables more screen reader magic which is intended to make a complex component more approachable and standardized (though it does come with the potential downside of another layer where bugs may show up and being less approachable to those with less screen reader experience).

Because we have limited capacity to do real world testing, I think we should be more closely aligning to the spec. When I have time, I have it on my roadmap to come back to this component to do further Windows testing but I think that's out of scope for this PR. (With more testing, we can polish the experience past "this meets spec expectations" to "this works in user environments.")

My full testing notes comparing what's in EUI today and this PR

EuiSelectable today

  • In VO+Chrome/Edge:
    • In the list version:
      • Announces you're on a listbox
      • Tabbing does not read items, shift+tabbing does
      • Arrowing does nothing, need to shift+tab+tab to start moving again
      • No way to tab into virtualized options (tabs out of the list)
      • Options always appear not selected
    • In the searchable version:
      • In the input field, it doesn't announce you're in a combobox or that there are options
      • Arrowing does nothing
      • No way to tab into virtualized options (tabs out of the list)
      • Options always appear not selected
      • Tabbing doesn't read items, shift+tabbing does
  • VO+Safari is mostly similar but does not announce how many options are either

EuiSelectable after this PR

  • In VO+Chrome/Edge:
    • In the list version:
      • Arrows work as expected (Reads " <is/is not selected> ")
      • Tabbing works as expected (one tab stop for the whole list, the list is not an actual tab stop, the first selected - or first if none selected - option is)
      • Selecting/deselcting is announced
    • In the searchable version:
      • Tab stop on input announced you're in a combobox and announced VO instructions to read options
      • Can navigate the list using cmd+option+arrow and cmd+option+space to select/deselect but arrow keys are silent (unsure what's expected here from the arrow keys, but VO controls still working is at least good). Using VO navigation and selection/deselection, everything seems to be announced as expected.
  • In VO+Safari:
    • In the list version:
      • Works similarly to the searchable version of VO+Chrome/Edge (i.e., you need to use VO's controls, not our controls, but using VO's controls everything works)
    • In the searchable version:
      • Works similarly to the VO+Chrome/Edge though using arrow keys will activate VO controls
      • Selection seems confusing because selection doesn't always seem to activate the one I just read but the last one I interacted with so I'm not sure if I'm missing a VO command I need to learn or if something is broken.

@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_3169/

@myasonik myasonik requested a review from cchaos July 6, 2020 16:48
@myasonik
Copy link
Contributor Author

myasonik commented Jul 6, 2020

@cchaos @chandlerprall This is ready for a final review again!

@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_3169/

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.

Code changes look good. Tested selectable's example in Chrome, FF, Safari, and Android Chrome without issue.

Copy link
Contributor

@miukimiu miukimiu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested locally and reviewed the code. LGTM!

@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_3169/

@myasonik myasonik merged commit 296e917 into master Jul 7, 2020
@myasonik myasonik deleted the feature/selectable-a11y branch July 7, 2020 19:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants