-
-
Notifications
You must be signed in to change notification settings - Fork 32.3k
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
[Chip] Document accessibility #18271
Conversation
No bundle size changes comparing a83a7b3...29faf65 |
3e29034
to
7dea468
Compare
c138097
to
e283869
Compare
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.
Something is not right with the tab on the autocomplete. Compare
- https://material-ui.com/components/autocomplete/#multiple-values
- https://deploy-preview-18271--material-ui.netlify.com/components/autocomplete/#multiple-values
Performing the following in 2. yields to two problems, there is no visual tip where the focus is, the alt-tab is stuck on the last input (the chip delete button receives the focus):
The chip isn't clickable and therefore not focusable. This is intended. If it's deleteable the delete icon should be focusable. If it's neither clickable nor deleteable then the chip demo has a fundamental issue. I can fix the issues with the chip demo. Probably best served by writing tests for the Autocomplete first. (This is why we write them) |
non-clickable chips are not part of the guidelines
bba9e6d
to
0b160e3
Compare
Ok this is an interesting use case that we can enhance. Currently keyboard users can't delete a specific value. The easiest solution would be to put every single chip in tab order. This does not scale very well with the number of tags. We could implement something like a I solved it for now by assuming that |
@eps1lon It looks like this thread uncovers a couple of different but interdependent concerns. Great! :) I will try to give feedback on each of them. But first, a benchmark, here are what I could find (something we can use to look at how people did handle or not the problem in the paste), I did collect this list before answering, and from my exisiting sources. I hope it's unbiased:
Keyboard focus visibleI think that we need a way to see that the delete action is keyboard focused. I believe it's not handled yet. Keyboard users can't delete a specific valueIf you refer to the autocomplete, yes, it's no longer possible to use the Left, Right, and Backspace keys to delete a specific value on But it's possible on v4.6.1.
In the case of the Autocomplete, it doesn't work because the Autocomplete tries to call If it's deleteable the delete icon should be focusableFrom the benchmark list, this behavior seems to depend on the implementations. I don't have a specific preference, I think that we could accept both. I think that it would be great to include @mbrookes in the discussion as he has some context on the chip component. On a side note, I really like @nareshbhatia's MultiSelectChipGroup group concept in https://nareshbhatia.github.io/react-force/?path=/story/multiselectchipcontrol--example. |
Agree, I think that the multi select autocomplete would benefit from test on the tag keyboard feature. Actually, during the implementation, I have started with a virtual focus approach to later change it for a dom focus approach. |
IMHO it should work as it currently does in 4.6.x - backspace deletes the prior chip, left arrow selects the prior chip and backspace deletes it. Interestingly, the react-select example still works as expected.
In what way? |
sigh back to writing tests for autocomplete. Wasting too much time otherwise. |
@eps1lon OK, I will write test cases for the tag multi select behavior. The timing is great. I hope it will help you and future iterations. |
Yes putting everything in tab order is always a solution. Though it makes navigation pretty annoying since you are reduced to a single button on the keyboard. That's the reason navigation within a widget is usually done with other keys. The same would apply here. There is still the fundamental issue that chips that aren't clickable are considered buttons. But if we do follow through with this PR we still haven't answered the accessible name story (which is pretty hard without So I guess I remove all the implementation changes and leave the testing story as is in this PR. Just keep in mind that the a11y story of Chips is problematic at the moment. |
Definitely, having to do the following isn't a good sign: |
Another tradeoff: https://elastic.github.io/eui/#/display/badge. Regarding how we can move forward. It seems that this is a challenging problem to solve. |
a964742
to
db0bba0
Compare
db0bba0
to
29faf65
Compare
Documents and tests a11y of different chip variants.
https://deploy-preview-18271--material-ui.netlify.com/components/chips/#accessibility
Fixes:
not-clickable chips being focusable (by clicking) and having a style for this stateRe-evalute chips for v5. We don't hide signifiers for buttons without onClick either and the design system has no notion of "not-clickable" either.deleteable but not-clickable chips not being accessiblethey are since the chip itself is always a button