-
Notifications
You must be signed in to change notification settings - Fork 377
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
Add aria-labelledby, aria-describedby and required properties to the search input #254
Conversation
Thanks for caring about a11y. I have very little knowledge on the subject myself. I have a couple questions about this:
|
Another question came to mind right now. Would you use |
Yeah you are right, the properties might have to go on the trigger. I'll do some testing and see what works. |
I imagine that part of the work has to be done upstream in ember-basic-dropdown, on which ember-power-select relies for everything non directly related with being a select. |
I think so, I was about to checkout the ember-basic-dropdown project to see if that was the case. |
Hmm, the |
Can't Also, if something cannot be pushed any further, I've always planed to create a |
Found out that adding role="combobox" enables support for |
class=(readonly concatenatedClasses) | ||
dir=(readonly dir) | ||
tabindex=(readonly tabindex) | ||
role="combobox" |
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.
The combobox role at the moment is added to the input where you type to search. I don't know where the correct place is, but having that in both is probably wrong.
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.
Might be necessary on both, as the trigger and the real combobox are separate pieces of DOM.
I'm not sure if these observations belong here or in the issue #21... There are some other concerns to be addressed for accessibility beyond labelling. For the single-select version, I think The role of The search box inside the popup needs to receive focus on opening (which it currently does) and then, instead of setting the role to In the And I think that will provide all of the functional wiring necessary to make this sucker completely accessible! |
@jmacqueen Thank you so much for the insight! That makes sense, I felt uneasy about the search input having the combobox role. My intuition told me that it wasn't right. If For what I understand If those attributes are required I might even consider to drop the It might be a bit harsh but it's for a good cause. |
@jmacqueen Also, when it comes to with groups like these http://www.ember-power-select.com/docs/groups what is the proper aria treatment of the hierarchy? Or having the groups being nested |
Heh. You've gotten ahead of me. I'm still looking through the various setups to make more recommendations 😄 Any time something in the ARIA spec wants you to reference another part of the DOM, it is done by id, so
For hinting the currently highlighted option, Styling using the ARIA attributes directly is the recommendation from WCAG, so feel free to drop the redundant classes. I'm fairly certain the nested |
I had some work in progress going, that addresses some of the issues described above, I pushed it in a WIP state, I promise I will continue working on it soon! |
#292 Takes care of using It also uses the latest version of ember-basic-dropdown from github, that has changed the Styles have been changed to target those roles. That will force people to create accesible components if they want to have default styles working. I haven't applied any tabindex to the options yet because I wasn't sure if it could interfere with the current behaviour (focus the next input after the select) |
Just to recap the current state of a11y now, this is the markup of a single select right now: <div id="ember477" class="ember-power-select">
<div id="ember-power-select-trigger-ember476" class="ember-power-select-trigger"
aria-haspopup="true" aria-expanded="true" aria-disabled="false" tabindex="0">
two
<span class="ember-power-select-status-icon"></span>
</div>
</div>
<!-- Somewhere else in the DOM -->
<div id="ember-basic-dropdown-wormhole">
<div class="ember-power-select-dropdown ember-power-select-dropdown-ember476">
<div class="ember-power-select-search">
<input type="search" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" role="combobox">
</div>
<ul id="ember595" role="listbox" class="ember-power-select-options">
<li class="ember-power-select-option" role="option" aria-selected="false" aria-current="true">
one
</li>
<li class="ember-power-select-option" role="option" aria-selected="true" aria-current="false">
two
</li>
<li class="ember-power-select-option" role="option" aria-selected="false" aria-current="false">
three
</li>
</ul>
</div>
</div> from the information shared here I understand that it should be like this: <div id="ember477" class="ember-power-select">
<div id="ember-power-select-trigger-ember476" class="ember-power-select-trigger"
+ role="combobox" aria-owns="ember-power-select-dropdown-ember476"
aria-haspopup="true" aria-expanded="true" aria-disabled="false" tabindex="0">
two
<span class="ember-power-select-status-icon"></span>
</div>
</div>
<!-- Somewhere else in the DOM -->
<div id="ember-basic-dropdown-wormhole">
<div class="ember-power-select-dropdown ember-power-select-dropdown-ember476">
<div class="ember-power-select-search">
- <input type="search" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" role="combobox">
+ <input aria-controls="ember-power-select-listbox-ember476" type="search" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false">
</div>
+ <ul id="ember-power-select-listbox-ember476" role="listbox" class="ember-power-select-options">
<li class="ember-power-select-option" role="option" aria-selected="false" aria-current="true">
one
</li>
<li class="ember-power-select-option" role="option" aria-selected="true" aria-current="false">
two
</li>
<li class="ember-power-select-option" role="option" aria-selected="false" aria-current="false">
three
</li>
</ul>
</div>
</div> Am I missing something? I also know there is some aria roles for |
The changes look good, except I think that the You are correct, the It hadn't really registered to me before that you can't tab into the list. You can probably dispense with the
I still haven't found anything definitive on the nested |
This might be unfortunate, although doable. Ember-power-select is built on top of ember-basic-dropdown. Ember basic dropdown is the component in charge of showing the popup, so I has hoping to be able to manager everything related to the popup functionality in it. As I understand, I'd expect the trigger to own the whole dropdown box, not just a part (the list of options inside). Can the entire dropdown be the If that is not forbidden, the entire dropdown can have the role |
Holy crap. I just had a major breakthrough! I've been torturing the spec trying to make this setup work under the <div id="ember477" class="ember-power-select">
<div id="ember476-trigger" class="ember-power-select-trigger"
role="button" aria-pressed="true" aria-owns="ember476-dropdown" //new stuff
aria-haspopup="true" aria-expanded="true" aria-disabled="false" tabindex="0">
two <span class="ember-power-select-status-icon"></span>
</div>
</div>
<!-- Somewhere else in the DOM -->
<div id="ember-basic-dropdown-wormhole">
<div class="ember-power-select-dropdown" id="ember476-dropdown">
<div class="ember-power-select-search">
<input aria-controls="ember476-listbox" type="search" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false">
</div>
<ul id="listbox-ember476" role="listbox" aria-controls="ember476-trigger" class="select-options">
<li role="option" aria-selected="false" aria-current="true" class="select-option">one</li>
<li role="option" aria-selected="true" aria-current="false" class="select-option">two</li>
<li role="option" aria-selected="false" aria-current="false" class="select-option">three</li>
</ul>
</div>
</div> The main differences are on the trigger element:
And then
And I did find a reference that suggests using |
This can probably be closed now since #433 is merged. |
See #21