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

[EuiSelectable] List enhancements and a11y #5581

Merged
merged 22 commits into from
Feb 4, 2022

Conversation

thompsongl
Copy link
Contributor

@thompsongl thompsongl commented Jan 31, 2022

Summary

Supporting changes required in #5157 and #5387 related to EuiSelectable and its subcomponents

Checklist

  • Check against all themes for compatibility in both light and dark modes
  • Checked in mobile
  • Checked in Chrome, Safari, Edge, and Firefox
  • Props have proper autodocs and playground toggles
  • Added documentation
  • Checked Code Sandbox works for any docs examples
  • Added or updated jest and cypress tests
  • Checked for breaking changes and labeled appropriately
  • Checked for accessibility including keyboard-only and screenreader modes
  • A changelog entry exists and is marked appropriately

@thompsongl thompsongl mentioned this pull request Jan 31, 2022
9 tasks
@kibanamachine
Copy link

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

@kibanamachine
Copy link

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

@thompsongl thompsongl marked this pull request as ready for review January 31, 2022 23:04
Copy link
Contributor

@1Copenut 1Copenut left a comment

Choose a reason for hiding this comment

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

LGTM. I tested with Axe, keyboard navigation and JAWS. The screen reader experience felt good and it announced changes as expected.

Comment on lines 296 to 298
case keys.ENTER:
case keys.SPACE:
if (event.key === keys.SPACE && this.props.searchable) return;
Copy link
Contributor

@cee-chen cee-chen Feb 1, 2022

Choose a reason for hiding this comment

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

I still think this needs reworking to change the event area of this keyDown handler to the list only and not include the search box. That way we don't need this this.props.searchable check and the spacebar can always toggle options on/off. Thoughts?

Copy link
Contributor Author

@thompsongl thompsongl Feb 1, 2022

Choose a reason for hiding this comment

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

No keyboard events actually derive from the list. All keyboard interaction, including that which appears to be on the list, is handled from the search box. Focus, etc. are all faux states on the list items, and you'll notice that the cursor remains in the search input at all times.

space is the more standard select/deselect key (according to Zuhair #5157 (comment)) which is why it was added. This does present challenges to searchable instances because space is also a valid character. For this case, we've added the SR announcement that enter will toggle selections, which is less standard but gives enough information to hopefully prevent using space for selection purposes.

Copy link
Contributor

Choose a reason for hiding this comment

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

All keyboard interaction, including that which appears to be on the list, is handled from the search box.

That doesn't have to be the case however. The onKeyDown handler is being passed to the container div when it (or a separate handler) could easily be passed only to the list instead.

I agree that space is a more standard select/deselect key. I want it to work period over the selectable list even when a searchbox is present. I'll provide a diff/commit POC to cherry pick, I strongly feel this is a keyboard/accessibility enhancement we should provide while we're here

Copy link
Contributor

@cee-chen cee-chen Feb 1, 2022

Choose a reason for hiding this comment

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

Here's my brief spike: thompsongl/eui@3733-selectable...constancecchen:3733-selectable

It works well with for keyboard usage but I'm not 100% that the screen reader experience is 1:1. I plan on picking Trevor's brain on this tomorrow.

Copy link
Contributor Author

@thompsongl thompsongl Feb 2, 2022

Choose a reason for hiding this comment

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

After rereading the 1.2 spec, I'm thinking that we might be better served to remove space selection and continue with enter as the selection mechanism.
As is, we conform to the spec for both searchbox and list interaction when using arrow and enter, and space is never mentioned. Similarly, the react-aria implementation confirms the current approach.

If we change to something along the lines of your spike, we'd probably need to remove faux active option state because the indicators no longer match the keyboard expectation. Given the following:

Screen Shot 2022-02-02 at 10 26 45 AM

  • enter makes no selection
  • space makes no selection and results in an empty list (because no options start with empty space)
  • down moves the active option indicator to Titan instead of Dione

cc @1Copenut for validation. We can sync if it's easier to discuss in real time.

Copy link
Contributor

@cee-chen cee-chen Feb 2, 2022

Choose a reason for hiding this comment

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

After our sync call, we've decided to leave potentially splitting up EuiSelectable (listbox) and EuiSearchableSelectable (combobox) as an internal tech debt refactor for another day. In the meanwhile we'll just need to leave a ton of inline code comments+links to the WAI-ARIA specs/examples so that we don't end up having this exact convo again in another 4 months :trollface:

For the spacebar UX, I also suggested changing the "Return/Enter" icon on the right of the EuiSelectable item to the word "Space" for when the component is a listbox vs a combobox, to give keyboard sighted users a visual cue that the toggle button is different when the searchable prop is present.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For the spacebar UX, I also suggested changing the "Return/Enter" icon on the right of the EuiSelectable item to the word "Space" for when the component is a listbox vs a combobox

After some thought, I think we should open an issue to create a new icon for spaceKey and use that icon when available.

Copy link
Contributor

@cee-chen cee-chen Feb 2, 2022

Choose a reason for hiding this comment

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

Makes sense. Do we have the option to put a title prop on that icon to indicate the words "Enter" and "Space"? 🤔 So could we use the empty icon for now, or maybe the minus icon with a transform on it?

Although thinking that though, keyboard users likely won't be able to mouseover to see the title tooltip in any case... so... that was probably a dumb idea 💀

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'm going to open an issue for this so we can get designer input as well. The returnKey icon is still valid for the listbox case and any enhancement there isn't relevant for the EuiSuggest PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👉 #5598

@kibanamachine
Copy link

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

@cee-chen
Copy link
Contributor

cee-chen commented Feb 1, 2022

@1Copenut VO+Mac isn't reading out any notifications for me - either the visual text or "0 results" - when a search filter box returns no results:

Can you repro? Is this intended behavior?

@1Copenut
Copy link
Contributor

1Copenut commented Feb 1, 2022

@constancecchen & @thompsongl

VO+Mac isn't reading out any notifications for me - either the visual text or "0 results" - when a search filter box returns no results:

Can you repro? Is this intended behavior?

I can reproduce the issue. Watching the DOM update in Chrome, it looks like our EuiScreenReaderOnly component is being removed when a status message is added. We will want that to be announced. Constance has an idea that we can discuss tomorrow.

@kibanamachine
Copy link

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

@thompsongl
Copy link
Contributor Author

VO+Mac isn't reading out any notifications for me - either the visual text or "0 results"

Resolved in 5ef8ab4, which will also aid loading and error states.

@kibanamachine
Copy link

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

@thompsongl thompsongl requested a review from cee-chen February 2, 2022 19:33
@kibanamachine
Copy link

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

@kibanamachine
Copy link

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

@kibanamachine
Copy link

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

@cee-chen
Copy link
Contributor

cee-chen commented Feb 4, 2022

Apologies, had a really gnarly day with the Typescript PR, will look at this first thing Friday morning!

@1Copenut
Copy link
Contributor

1Copenut commented Feb 4, 2022

@thompsongl & @constancecchen I retested with VO on Safari latest this morning. The error message and no results found message are announcing reliably and the refactor has improved the experience for single select too. Much appreciated!

@kibanamachine
Copy link

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

@cee-chen

This comment was marked as resolved.

@kibanamachine
Copy link

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

thompsongl and others added 2 commits February 4, 2022 14:16
….tsx

Co-authored-by: Constance <constancecchen@users.noreply.github.com>
Copy link
Contributor

@cee-chen cee-chen left a comment

Choose a reason for hiding this comment

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

All of my remaining comments are super optional! Thanks so much for your patience with me on this Greg!

@kibanamachine
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants