-
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
[EuiSelectable] List enhancements and a11y #5581
Conversation
Preview documentation changes for this PR: https://eui.elastic.co/pr_5581/ |
Preview documentation changes for this PR: https://eui.elastic.co/pr_5581/ |
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.
LGTM. I tested with Axe, keyboard navigation and JAWS. The screen reader experience felt good and it announced changes as expected.
case keys.ENTER: | ||
case keys.SPACE: | ||
if (event.key === keys.SPACE && this.props.searchable) return; |
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 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?
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.
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.
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.
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
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.
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.
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.
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:
- 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 ofDione
cc @1Copenut for validation. We can sync if it's easier to discuss in real time.
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.
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
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.
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.
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.
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.
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 💀
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'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.
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.
👉 #5598
Preview documentation changes for this PR: https://eui.elastic.co/pr_5581/ |
@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? |
Preview documentation changes for this PR: https://eui.elastic.co/pr_5581/ |
Resolved in 5ef8ab4, which will also aid loading and error states. |
Preview documentation changes for this PR: https://eui.elastic.co/pr_5581/ |
Preview documentation changes for this PR: https://eui.elastic.co/pr_5581/ |
Preview documentation changes for this PR: https://eui.elastic.co/pr_5581/ |
Preview documentation changes for this PR: https://eui.elastic.co/pr_5581/ |
Apologies, had a really gnarly day with the Typescript PR, will look at this first thing Friday morning! |
@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! |
Preview documentation changes for this PR: https://eui.elastic.co/pr_5581/ |
src/components/selectable/selectable_list/selectable_list_item.tsx
Outdated
Show resolved
Hide resolved
src/components/selectable/selectable_list/selectable_list_item.tsx
Outdated
Show resolved
Hide resolved
This comment was marked as resolved.
This comment was marked as resolved.
src/components/selectable/selectable_list/selectable_list_item.tsx
Outdated
Show resolved
Hide resolved
Preview documentation changes for this PR: https://eui.elastic.co/pr_5581/ |
src/components/selectable/selectable_list/selectable_list_item.tsx
Outdated
Show resolved
Hide resolved
….tsx Co-authored-by: Constance <constancecchen@users.noreply.github.com>
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.
All of my remaining comments are super optional! Thanks so much for your patience with me on this Greg!
Preview documentation changes for this PR: https://eui.elastic.co/pr_5581/ |
Summary
Supporting changes required in #5157 and #5387 related to
EuiSelectable
and its subcomponentspaddingSize
option toEuiSelectable
to allow for "flush" list items (to be used byEuiSuggest
)errorMessage
option toEuiSelectable
([EuiFilterGroup][FieldValueSelectionFilter] UseEuiSelectable
#5387 (comment))aria-checked
instead ofaria-selected
for active itemsChecklist