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
Fix NVDA reading blank on Select2 multiple option #5571
Conversation
Alright, now that I understand what we are doing here, I can give some recommendations. We are going to want to assign the
We can predict what the ID for the results should be, since we calculate it already for single selects, and we should calculate it the same way for multiple selects. Note that we use select2/src/js/select2/selection/single.js Lines 33 to 36 in d66f871
We want to set the ID on the this.$search.attr('aria-labelledby', id); The other useful thing to have would be tests, so we know that this is being consistently assigned. And so when we come in later and wonder why we did this, we will have a test fail when we go to remove it. We already have a few basic ones at |
Hi @kevin-brown , Thank you so much for the detailed feedback, i'll try to put hours in next week to get this done! |
Sorry I don't want to sound dismissing and I appreciate the effort made here but this approach based on
Instead, the UI pattern fo follow is the https://www.w3.org/TR/wai-aria-practices-1.1/#combobox There are a few examples there, here's one of them: They're based on See also: Making Select2 accessible, a possible plan |
There's no established UI pattern for that in the ARIA Authoring Practices, nor anything applicable in the ARIA spec I can think of. The closest one is Example 2 here: https://www.w3.org/TR/wai-aria-practices-1.1/examples/listbox/listbox-rearrangeable.html which is closer to a Though those "tags" are a common design in select-replacement libraries, they aren't exactly a "native" UI or something close to a native UI. Also, those "tags" are actually outside of the input field. They represent the list of selected options so maybe I'd just use a list, preferably with some text to explain what the list is about. |
@afercia It is already a list : How would you link the list and input when focused together? |
Yeah but what I see in the multi-select boxes example, is that also the input field is within a list item: That defeats the purpose of using a list 🙂What the current list is actually communicating? Semantically (and assistive technologies will get this info) it's saying:
How that can be helpful for users? Additionally:
Re: a way to "link" the selected options to the input field; I'm not sure there's a good way to do it in a way that can be easily understood by assistive technologies users. I'd just use plain text. Maybe visually hidden text. |
Alright so from what I understand (correct me if i'm wrong)
anything else to add to this list @afercia ? |
Not sure I understand this part 🙂 What I meant is, in pseudo-code:
|
For what is worth, in the new WordPress block editor (Gutenberg) the "X" icons are actually buttons so they're focusable and operable with a keyboard. Also, they have an
This way, the button is announced as "Remove Tag {brief pause} claycold (1 of 2)". I do realize this is a bit out of the scope of this pull though 🙂 |
@afercia would be possible for you to add issues of all the things you mentions that are out of scope of this issue? Because all this great info will be lost and in this PR I don't think we will do every accessibility issue that you list cc @kevin-brown I understand for the text before the list, but how do we link a focus into the input to the list? Because that visually hidden text will only be accessible if you navigate with the arrow up and arrow down in nvda and jaws. If someone navigates through labels and forms only they will miss this info |
One option could be adding an Something like:
It could be a bit redundant but it's better than a resounding silence.
Thanks, yep I do realize there's the risk some feedback will be lost. However, it took me 5 days to reply to the previous comment. I'm afraid I'm a bit busy 🙂 |
That's a great solution thank you so to we will go with your last solution. @kevin-brown can you give the green light so we can start working on this please? @afercia are you okay with me creating the issues, i'll reference to your comments in each issue |
@StephenBe I'm super okay, thanks! |
@afercia because there is already a list there I suggest we do :
|
I nevermind that won't work because the user would need to do the arrow to access the list |
I wouldn't be too worried for that. With screen readers, the main mode to explore content is by using arrows. The tab key is used mainly within forms or when users discover a quick path to get where they want (e.g. jump to second heading, then press right arrow once, then press tab twice). |
I understand, but in this case the user will be focused in the input so even an arrow down or up won't help if I remember the aria-describedby correctly. |
Not sure I understand 🙂
|
well the id that is linked with the aria-describedby is only on the span not the list, but actually we could wrap the span and list in a div with the proper id like this :
|
Well,
As per using a list wrapper as the target for |
yeah I miswrote, I edited it out to an id. Ok correct me if i'm wrong, but the problem I see with having a span with the id and the list underneath is this : If I focus on the input, the aria-describedby will look for an id and find the span and read :
The list will not be called out and you wont have access to it because you are currently focused on the input. Is that correct? |
Ahh yes, sorry I mis-coded the pseudo-code 🙂 I'm assuming there will be some code responsible to put the actual selected values within the hidden span, as in one of the previous examples see #5571 (comment)
or, when no option is selected:
|
Alright great we will go with that once @kevin-brown gives the green light. Thanks for your valuable feedback, very much appreciated! |
Sorry for the late response here, I've been following the conversation here but wanted to write up a longer response and have decided that I should throw out that idea.
Go for it. I will gladly review the new/updated pull request. Some things to note along the way:
This is something I've been looking at, since it's an area where Select2 is very much so not accessible at the moment. The only way to remove selected items in a multi-select using your keyboard is to make them appear in the results again and deselect them there. If someone wants to write up a quick ticket (doesn't have to be super detailed, but link back to here), this is an area I would love to improve on for 4.1.0. |
Not a review, but I just want to say THANKS for taking care of this. |
@kevin-brown, @StephenBe, and @afercia, thank you for all of the time, thought and effort that you have put into this. |
I found this pull request after reproducing the 'times' @afercia 26 July
@StephenBe 27 July
This is one of many accessibility issues discussed in the comment thread. However the pull request only addresses one specific issue. Are there existing pull requests addressing the other issues, or do you have a plan for tackling and testing them en masse, or should I log individual issues so they can be addressed individually? Thanks. |
I have opened a pull request at #5842 which aims to redo the accessibility of the selection area with multiple and single selects to make them more accessible to screen readers. One of the main changes involves changing the selection to ensure the selected items are read out to the user when the search and other areas are focused. The pull request includes a list of notable changes, but to be honest the majority of the changes we are putting into place were discussed throughout the years on this pull request as well as many related accessibility tickets. While I understand that it has been a while, it would be greatly appreciated if anyone could help us test out these changes to ensure this ticket has been fixed. You can test these on your own by recompiling Select2 from the lastest |
Thank you for your work! I've been holding off selecting a multiselect control in a project I'm developing due to this issue; I'm happy to help once I can get it off a CDN. |
This pull request includes a
The following changes were made
If this is related to an existing ticket, include a link to it as well.
#4418