-
Notifications
You must be signed in to change notification settings - Fork 22
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
Incorrect aria-labelledby
in useDropdownMenu()
#50
Comments
This hook is used in https://github.com/react-bootstrap/react-bootstrap/blob/master/src/DropdownMenu.tsx const [menuProps, { hasShown, popper, show, toggle }] = useDropdownMenu({...})
// props.aria-labelledby === 'Custom label'
return (
<Component
{...props}
{...menuProps}
style={style}
className={...}
/>
) |
A Popover/dropdown isn't a select input replacement. There is a ton of additional a11y to make a select element work correctly and that is beyond the scope of what the dropdown is for out of the box. I'm ok with making things like this opt out for folks that want to build more complex elements but it takes a significant more than this to make something like a color picker accessible. Generally speaking a dropdown is the wrong category of widget for that. |
I see. Well, there's nothing else resembling a select replacement in the components list. For some reason, Bootstrap doesn't want to add a custom Select component. A native select's styling capabilities are very limited in terms of the options list style. Maybe they have their own reasons like better accessibility. |
There are lots of options for custom form input libraries! I am partial to http://jquense.github.io/react-widgets/ myself. |
https://github.com/react-restart/ui/blob/main/src/DropdownMenu.tsx
aria-labelledby
is forced to be theid
of the toggle element.But that's not correct.
Consider a color selector with options:
Initially the toggler button's text is: "Select a color".
After the user selects "Green" color, the toggler button's background color becomes green and the text inside the button says: "Green".
Then the user focuses out of the toggler button, and then focuses back in.
A screen reader says: "Green".
"Green" what?
Suppose option labels are "A", "B", "X123".
A correct way would be somehow allowing a custom
arial-labelledby
property/option, or maybe just anaddAriaLabelledBy: false
opt-out flag.The text was updated successfully, but these errors were encountered: