-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Investigate creating an accessible custom select/dropdown component #16473
Comments
cc. @epiqueras who I think was looking into this a little. |
It's @enriquesanchez 😆 |
I tested both Deque's custom select and React-select on Mac (Safari + VoiceOver) and Windows (Firefox + NVDA). Deque's custom select worked like charm in both cases. React-select did not work well for me, I had trouble getting the screen reader to properly read aloud the available options. My vote goes for moving forward with Deque's custom select, I think it would allow us to have custom styling on dropdowns (for font selection, text size, etc.) like we used to while also being accessible. I'm adding the 'Needs Accessibility Feedback' label in order to get more eyes from the a11y team and see what they think. |
The discussions in #16666, are relevant here.
|
On #16666 what's being discussed is an "autocompleter", which is a bit different from a select replacement. I've commented there, see #16666 (comment)
Assuming Gutenberg really needs a In the last 5 years the accessibility team tested various select-replacement libraries. Most of them are not accessible: Here's the Select2 accessibility testing and evaluation the a11y team posted on September 2015: https://make.wordpress.org/accessibility/2015/09/07/accessibility-usertest-select2/ See also
#5921 (comment)
Both Select2 and react-select have accessibility-related open issues and some work is (slowly) being done. As of today, they're still not accessible. The Deque custom select looks promising and maybe it would be a nice opportunity to collaborate with Deque to refine some details. Finally, looks like some W3C folks are considering to standardise and make fully styleable the native The proposal is included in the Web Incubator Community Group (WICG) and it's in an investigation phase. [Edit] This link is dead, please refer to https://github.com/WICG/open-ui and https://open-ui.org/ |
Accesible autocompleters/comboboxes and dropdowns/selects usually share a
lot of code.
That’s why I proposed 2 of the most popular libraries for easily
implementing accessible inputs to power all of them.
…On Tue, Aug 6, 2019 at 7:13 PM Andrea Fercia ***@***.***> wrote:
The discussions in #16666
<#16666>, are relevant here.
On #16666 <#16666> what's
being discussed is an "autocompleter", which is a bit different from a
select replacement. I've commented there, see #16666 (comment)
<#16666 (comment)>
in some circumstances we need to customise the options in a dropdown
Assuming Gutenberg really needs a <select> replacement:
In the last 5 years the accessibility team tested various
select-replacement libraries. Most of them are not accessible:
Here's the Select2 accessibility testing and evaluation the a11y team
posted on September 2015:
https://make.wordpress.org/accessibility/2015/09/07/accessibility-usertest-select2/
See also
#5921 (comment)
<#5921 (comment)>
(24 May 2018)
Since then, some new select replacement like SelectWoo and react-select
improved some of the accessibility issues but they're still not fully
accessible.
#5921 (comment)
<#5921 (comment)>
(2 Apr 2018)
From an accessibility perspective, react-select is not so different from
Select2. Unfortunately, it is not accessible.
Both Select2 <select2/select2#5571> and
react-select
<https://github.com/JedWatson/react-select/issues?utf8=%E2%9C%93&q=commenter%3Aafercia>
have accessibility-related open issues and some work is (slowly) being
done. As of today, they're still not accessible.
The Deque custom select looks promising and maybe it would be a nice
opportunity to collaborate with Deque to refine some details.
Finally, looks like some W3C folks are considering to standardise and make
fully styleable the native <select> element and other form controls:
https://twitter.com/gregwhitworth/status/1150771325075542016
The proposal is included in the Web Incubator Community Group (WICG)
<https://github.com/WICG> and it's in an investigation phase
<https://github.com/WICG/form-controls-components/blob/master/select/overview.md>
.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#16473?email_source=notifications&email_token=AESFA2CWZJTPYFLXLSP7PHTQDIARJA5CNFSM4H7BNANKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD3WXAOI#issuecomment-518877241>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AESFA2DPLPJFBO4I2JOPOBTQDIARJANCNFSM4H7BNANA>
.
|
Selects and autocompletes may look a bit similar, but their purpose is quite different: select presents you with a limited list of choices from which you can select one or more options; autocomplete is essentially a search type input with a bit of added functionality. Here's a really good talk about what it takes to build an accessible autocomplete: https://www.youtube.com/watch?v=_w6KvvN9cWw (spoiler: it's anything but easy 😄) My take on this is that it's better to have two solid single-purpose components than one bloated one that tries to do everything at once. There may be utility functions, e.g. for keyboard navigation, that we can share between components, but they shouldn't have much more in common than that. |
Comboboxes are dropdowns with dynamic options derived from a text input.
Take a look at the code for the libraries I suggested, Reach and Downshift.
…On Tue, Aug 6, 2019 at 8:45 PM tellthemachines ***@***.***> wrote:
Accesible autocompleters/comboboxes and dropdowns/selects usually share a
lot of code.
Selects and autocompletes may look a bit similar, but their purpose is
quite different: select presents you with a limited list of choices from
which you can select one or more options; autocomplete is essentially a
search type input with a bit of added functionality. Here's a really good
talk about what it takes to build an accessible autocomplete:
https://www.youtube.com/watch?v=_w6KvvN9cWw (spoiler: it's anything but
easy 😄)
My take on this is that it's better to have two solid single-purpose
components than one bloated one that tries to do everything at once. There
may be utility functions, e.g. for keyboard navigation, that we can share
between components, but they shouldn't have much more in common than that.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#16473?email_source=notifications&email_token=AESFA2H5OQ6MIHUMHLCINVDQDILJ5A5CNFSM4H7BNANKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD3W3KJY#issuecomment-518894887>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AESFA2HMQBXZBZUXEAN6YT3QDILJ5ANCNFSM4H7BNANA>
.
|
Comboboxes are input elements where a dropdown with options is rendered based on what you type in the input. Because they are search type inputs, they need to have a reset button and a search button too.
Reach UI is not production ready. They don't have a select component, and their combobox example is broken: typing in any letter brings up the whole list, which is not expected behaviour. For reference, here are some examples of how comboboxes are supposed to work: https://www.w3.org/TR/wai-aria-practices/examples/combobox/aria1.1pattern/listbox-combo.html According to discussion here we've already tried downshift and it wasn't accessible enough. Given that they have an open issue from Nov 2018 to look into accessibility issues, it doesn't look like they are making much progress in that area. |
So how is this going to move forward? Have you tried Deque’s select which
the other Enrique recommended?
…On Tue, Aug 6, 2019 at 9:35 PM tellthemachines ***@***.***> wrote:
Comboboxes are dropdowns with dynamic options derived from a text input
Comboboxes are input elements where a dropdown with options is rendered
based on what you type in the input. Because they are search type inputs,
they need to have a reset button and a search button too.
Selects are not inputs. You can't type into them, though you can use your
keyboard to pick a specific option. When you click or press space on the
select, all the available options are presented in a dropdown. There's good
reason for there to be a specific HTML element dedicated to them 🙂
Take a look at the code for the libraries I suggested, Reach and Downshift.
Reach UI is not production ready. They don't have a select component, and
their combobox example is broken: typing in any letter brings up the whole
list, which is not expected behaviour. For reference, here are some
examples of how comboboxes are supposed to work:
https://www.w3.org/TR/wai-aria-practices/examples/combobox/aria1.1pattern/listbox-combo.html
According to discussion here
<#16666 (comment)>
we've already tried downshift and it wasn't accessible enough. Given that
they have an open issue from Nov 2018
<downshift-js/downshift#617> to look into
accessibility issues, it doesn't look like they are making much progress in
that area.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#16473?email_source=notifications&email_token=AESFA2D533NN2ZIBCNDO5TDQDIRFTA5CNFSM4H7BNANKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD3W5Q4A#issuecomment-518903920>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AESFA2DOJ7OFWOE6PL33QDDQDIRFTANCNFSM4H7BNANA>
.
|
Procedural note 🙂Please avoid to quote the whole previous comment when replying. While the GitHub UI hides the previous comment, the notification emails show both the reply and the previous comment. Reading through all that quoted text is a terrible experience. Thank you! |
I don't add it. It's the GitHub reply to email flow that does it. |
Thanks for reviewing this @afercia!
I'm curious to know if you found any issues with Deque's implementation? I know you had some initial observations on #16148. |
@enriquesanchez thank you for reviewing and for the ping on Slack! Testing the two selects on https://pattern-library.dequelabs.com/components/selects with screen readers on Windows, here's some random observations compared to native behavior: native
the Deque select:
To me, the most important issues are:
All of this demonstrates that, even if well thought and coded:
That said, screen readers are just one assistive technology 🙂I'd like to see the Deque select tested at least with a couple more assistive technologies:
|
@afercia thanks for the thorough review! To summarize, a custom select should:
Would this be a reasonable list of requirements for any custom select to be considered? |
@enriquesanchez yes that would be great.
This one is a bit tricky. Browsers (at least Chrome and Firefox) expose a native |
Have you tried |
Hey @silviuavram! Thanks for the suggestion. I ran a quick test with On Safari + VoiceOver (Mac): ❌ announce its role as Firefox + NVDA (Windows): ❌ announce its role as Also, and while this may be only a styling issue, the element looks like a button instead of a select element. |
Thank you @enriquesanchez for the feedback. I'd be happy to follow up on your points. I plan to merge For For For changing the options when the select is closed, I am not sure what you mean. Is this a You are responsible with the styling, so it is up to you how you do it. But for a Maybe we can sync more on requirements and also if you can provide an example with a fully working widget, anywhere on the internet, maybe that will be helpful as well. All the best! |
Hey @silviuavram!
On Windows, a native select element is announced by screen readers as a
I believe it's possible with
This is an option available on Windows. You don't need to expand the list of options in order to scroll through the list. |
@ItsJonQ has been helping me with the implementation of a custom dropdown/select that covers most of the requirements laid out on this issue. While there are still some rough edges, we want to hear your feedback. I've been testing it with NVDA+Firefox on Windows and VoiceOver+Safari on Mac and would like to hear from others. The custom dropdown/select can be found on this Codesandbox: https://2gbb9.csb.app cc. @afercia |
@enriquesanchez that's a great start, thanks! :) I spotted one bug: when using the up/down arrow keys inside the popup "menu" to select an option from the list of predefined choices, the HTML page scrolls up/down. Missing |
Apple MacOS, Voice Over, Google Chrome web browser:
|
If implementing it from the ground up is what you wish, sure, go ahead. I did not add those by default because I follow the W3C design pattern for it, and their specs are different. |
Really great testing, @enriquesanchez! Thanks! While waiting to hear from @silviuavram, can we create a PR with |
That is awesome @enriquesanchez thank you for the feedback! I will get back to this next week as I'm feeling under the weather now. But yes, you can create the PR. you can remove aria-labelledBy by passing it as undefined to the getToggleButtonProps and passing aria-label instead. Just make sure to do it also in the getMenuProps, that's labelled by the Label as well. Also make sure you use latest Downshift (3.3.4). Good luck and leave comments here I will address them once I will feel better. |
@silviuavram Thanks for all the work here! We're experimenting with this fork: https://codesandbox.io/s/wordpress-components-dropdown-font-size-picker-bwvf2
This is fixed.
This is still an issue. Do you have any idea what it might be? |
Added a couple of suggestions in the PR @epiqueras |
Flagging #16666 and #7385 as related here, as they go a different direction with an accessible select menu as they use accessible-autocomplete package. Looping in @adamsilverstein as he worked on those PRs. |
@epiqueras I don't own a license of Dragon Speech (and not really sure if I can get a trial and for which product). Hopefully you can find the issue by |
@silviuavram Me neither, and it's Windows only 😢 Is there anyone on this thread available for pair programming? 😄 |
With Dragon Home/Speech.* |
@grahamarmfield and @ewaccess might be able to help with Dragon, if they have a chance 🙂 They would need a testable page though, not something they need to set up, install pagkaces, etc. |
The debug info shows in the console. |
@enriquesanchez did some testing with Dragon on #17418 which was our previous attempt at this. |
Looks like the custom select component merged in #17926 misses a few basic things to be considered a working replacement for some basic (not all) features of a native Most importantly, the currently selected value is not exposed programmatically so any software including screen readers won't be able to understand what the currently selected option is.
This happens because the button is labelled (actually it's labelled twice) so the label value overrides the button content: Both the Inspecting the accessible properties with Firefox, the relevant difference is that this custom component ha an accessible name but no value: while a native Note also the At the very least there's the need to:
Worth also mentioning that native Reopening to address the two points above. I'd also like this issue and the implementation from #17926 to be discussed in the next accessibility team meeting. |
We added
It would be great to have some more opinions on this! Unfortunately I can't join because the meeting takes place in the middle of the night for me, but more than happy to discuss asynchronously 🙂 |
Got it. The root problem is:
Overall, even if this component tries to use ARIA techniques it is still a non-native implementation that reduces the accessibility of this control and as such it's actually an accessibility regression compared to the implementation with a native I'd also like to remind the previous implementation with the custom font size selector was flagged as a WCAG failure by the WPCampus audit in #15319. That's the reason why it was changed to a native That said, I do realize others in the team strongly feel in favour of this component because they want a "preview" of the font size. For what is worth, I can't really support this implementation as it comes to a cost of reduced accessibility. I'd like to point out there are other ways to show a preview that haven't been even considered. |
@afercia is right, the button being triggered by the label click is an unfortunate side effect.
Of course a native Do you think of any improvements that can be done here in terms of accessibility? |
I'd start strictly following the pattern described on the ARIA Authoring Practices. The patterns described there are the ones assistive technologies are supposed to support.
This way, also the selected value within the button will be announced by screen readers e.g.: Then, this should be tested again with Dragon and other speech recognition software, e.g. Voice Control / Dictation on macOS. Still, the different behaviors and interactions across operating systems and browsers can't be covered by a custom component. That's my main concern as they greatly differ and users are used to them. |
As I understand the About the |
Removing only the Yes the aria-labelledby with two IDs should be tested again with speech recognition software but that's the only way I can think of to make assistive technologies announce also the currently selected "option" as they would do with a native |
The label will not be orphaned, as it will still have the |
I'm closing this issue as we now have both |
Is your feature request related to a problem? Please describe.
HTML
select
elements are not visually customisable, and in some circumstances we need to customise the options in a dropdown. When showing available text styles, for example:We also need these dropdowns to be fully accessible when used with keyboard, screen readers, voice commands, and any assistive technology.
Describe the solution you'd like
Investigate how to best achieve full accessibility while using non-semantic markup, with ARIA and custom keyboard interaction.
Previous discussion for reference:
#16148
Deque's custom select might be a good solution: https://pattern-library.dequelabs.com/components/selects
React-select is another possibility; there's ongoing work/discussion on accessibility improvements over there: JedWatson/react-select#2456
The text was updated successfully, but these errors were encountered: