hc-oss / react-multi-select-component

Lightweight (~5KB gzipped) multiple selection dropdown component

Home Page:https://codesandbox.io/s/react-multi-select-example-uqtgs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Aria role not set on the dropdown.

opened this issue · comments

Is your feature request related to a problem? Please describe.
Without an Aria role, some of the aria attributes set by the component such as "aria-expanded" conflict with WCAG guidelines and cause it to fail. (https://dequeuniversity.com/rules/axe/4.6/aria-allowed-attr). There is no default role set for the select component and there doesn't seem to be any way to pass one in.

Describe the solution you'd like
Either hardcode a default role of "listbox" or provide a prop where the role can be passed in like it is done with labelledby

Describe alternatives you've considered
Other options are to spread out any other props/attributes that are sent to the component across the main div. This way, user can set whatever attributes they want. Yet another option would be to change the implementation to use a forwarding ref so that the consumer can get hold of the ref and manipulate it themselves.