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
Dropdown accessibility - tab key #1441
Dropdown accessibility - tab key #1441
Comments
I know this differs from what bootstrap itself is doing, but for accessibility tab should close the menu. As noted in the pull request comment, I think a11y trumps bootstrap alignment (at least a little) https://www.w3.org/TR/wai-aria-practices-1.1/#menu
See their examples: If anything, I think there is a problem with tab focusing back on the toggle instead of the next element in the tab sequence. If others feel that bootstrap alignment is more of a priority maybe we can change it to work like bootstrap and maybe have a prop which can enable better a11y (or vice versa). |
@TheSharpieOne I think it would be good we can align with Bootstrap. |
If we are going to align more with bootstrap and less with aria suggestions, then there are other a11y suggestions which we current implement and bootstrap doesn't. Such as bootstrap's dropdowns do not wrap (hitting down arrow at the last item doesn't move focus to the first item). The way spacebar works (especially when the menu is open, reactstrap triggers the highlighted item (per wai aria practices) while bootstrap does nothing (causing the page to scroll)). Bootstrap doesn't implement a typeahead-ish thing where you can jump to an option based on the letter pressed (this is also in the wai aria practices) How far do we want to take this? The change request here is a pretty simple fix, we just completely ignore the tab key and we end up getting what bootstrap has. |
This adds a new a11y prop to Dropdrop, defaults to true. When the a11y prop is explicitly set to false: This changes the way tab works within the Dropdown. tab/shift-tab will move focus to the next logic item: tab will move down until the end. Then, at the end of the menu it will focus the next focusable item on the page and close the menu. shift-tab will move up until the start. Thenm, at the beginning of the menu it will focus the toggle and close the menu. Fixes #1441
This adds a new a11y prop to Dropdrop, defaults to true. When the a11y prop is explicitly set to false: This changes the way tab works within the Dropdown. tab/shift-tab will move focus to the next logic item: tab will move down until the end. Then, at the end of the menu it will focus the next focusable item on the page and close the menu. shift-tab will move up until the start. Thenm, at the beginning of the menu it will focus the toggle and close the menu. Fixes #1441
(Uncontrolled)Dropdown/DropdownMenu/DropdownItem
^7.1.0
^16.7.0
What is happening?
Dropdown menu lacks keyboard user accessibility-
On selecting to display a dropdown menu via the keyboard, pressing the
tab
key closes the menu, rather than tabbing through the dropdown itemsWhat should be happening?
tab
/shift
+tab
should operate in the same way as pressing theup
ordown
keys - ie. tabs through the dropdown items in either directionSteps to reproduce issue
tab
key to navigate to a dropdown (controlled/uncontrolled)tab
/shift
+tab
key(s) to tab through the dropdown itemsCode
Thank you
The text was updated successfully, but these errors were encountered: