-
Notifications
You must be signed in to change notification settings - Fork 163
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
Aria role listbox not suitable for Carousels #112
Comments
There is a discussion going on in the PR. Unlike bootstrap's carousel, our carousel captures keyboard events so you can use the left and right arrows to navigate. When you assign event handlers like onkeydown and onclick to a non-interactive HTML element, like a div, then Aria requires that you assign the element a role. At least that's my understanding of WCAG. listbox seemed like an option because you can tab to each visible slide in the slider. However, the audio that is read by a screen reader is a little misleading. It speaks of "options" to select. There's no options. If anyone has an idea of which role we should use in this situation, please speak up. |
@bluSCALE4 please see the response on PR #113 - I think we don't need to remove the listbox, but I think we could discuss if tablist would be a better option? |
@tim-steele I agree, tablist looks like a much better option for dots. But there's still the issue that a listbox semantically represents a http://www.webaxe.org/carousels-and-aria-tabs/
This is assuming that we're willing to draw a logical connection between a carousel and tabs. It does have similarities though a carousel includes additional functionality. |
How you guys looked at edit Though W3C claims |
Into the rabbits hole we go... found this recent conversation at There is another example that lurked in the code that I recreated. https://w65wynpw25.codesandbox.io/ What both these examples have avoided is adding actions listeners to the slides themselves so they successfully avoid dealing with |
@bluSCALE4 it does look like they are including the spec. I am reviewing their carousel recommendation here https://www.w3.org/TR/wai-aria-practices-1.1/#carousel. I don't think it is final yet. |
It is also important to note that many developers will over use a slider, not as a pure carousel but as a means of selection (ex: a product that has 10 different colors) in this case your list box maybe useful. Also if it is required that a selection be made then maybe even role="radiogroup" to help convey that this is part of a form selection. There is also possibilities of expanding the useful meaning of the buttons for screen readers (ex: next button should read "Next 3 of 10" or however many slides as visible VS remaining) Same for previous first and last."First 1 of 10" / "Last 10 of 10" Also usage of tab seems to be throwing the slider off. In your demo of "Simple Carousel With React Redux" attempt to only use the tab key to move through the slides. The proper order should be Slide 1,2,3 then Next arrow. However as you can see the tab order continues to push the slider all the way through the slides before ever getting to the next button. Even then when the user reaches the next button they do not know they are at the end of the ordered list because the next button is still a valid button. Usage of aria-hidden=true/false and tabindex=0/-1 will keep the hidden slides out the tab order. Good luck! |
As this doesn't currently have a clear solution, might it make sense for now to default to |
@hcientist would you be open to making a Pull Request for making it possible to override? @kylane mentions in Issue #315 the ability to override aria props, so it looks like it something that has support. |
Where have we landed on this one? Removing |
We found a very basic workaround to solve these issues for our purposes. Without going into too much detail on how the roles work, for us, it was enough to make this work with {/* Adding role={undefined} and trayProps={{role: 'listbox'}} fixes an issue
with accessibility. Basically, the role attribute was on the wrong element.
The role 'listbox' needs need wrap direct decedents with the role 'option'.
We hope that this gets addressed by the library soon. */}
<Slider
aria-orientation={carouselState.orientation}
aria-labelledby={carouselId}
classNameTrayWrap="carousel-tray-wrapper"
role={undefined}
trayProps={{role: 'listbox'}}
>
...
</Slider> |
The argument has been made here:
twbs/bootstrap#22061
The text was updated successfully, but these errors were encountered: