-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
Speak results in dropdown #3821
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
Conversation
@@ -54,6 +54,10 @@ define([ | |||
self.$search.trigger('focus'); | |||
}); | |||
|
|||
container.on('results:speak', function (params) { |
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.
Instead of using a custom event here, you can hook into results:focus
and use params.element.id
to get the id
of the element.
Sorry about the delay in reviewing this, I've left one in-line comment that hopefully can spark a bit of discussion. The Ideally we could also get some tests going alongside of this to ensure that we don't lose support for reading out options in the future. |
No problem, I haven't had much time to think about it this week anyway ... Good point about How about making errors And yeah, I was thinking it would be hard to write tests but actually it should be straightforward just to check that the attributes are set properly. I'll see what I can do :) By the way, @joedolson do you and the Wordpress team have any suggestions on this? |
Sorry this has taken me a while, but I've updated with |
This closes select2#3735 This closes select2#3821
Addresses #3735
As of select2 4.0, screen readers give no indication of which result in the combo box is highlighted. Previously, when the highlighted result was changed, the screen reader would read out the text of the item. This patch restores that functionality by setting up aria-autocomplete on the search box and changing its active descendant when moving up/down through the results. This means:
This has been tested in JAWS and NVDA, but not exhaustively (ie. only with multi-select boxes) so there may be cases where it doesn't work. Also, I'm not sure if it's a good idea to have a separate "results:speak" event, but it made sense at the time for reasons I've now forgotten ... let me know if there's a better place to change the active descendant.
See what you think and if there are any problems just let me know!
Jono