react-component / dropdown

React Dropdown
https://dropdown.react-component.now.sh/
MIT License
172 stars 103 forks source link

Accessibility is half-baked #17

Open marcysutton opened 8 years ago

marcysutton commented 8 years ago

Hi, I see there are some ARIA attributes in place for menus. However, the dropdown can't be navigated with the keyboard, and the trigger button is not associated with the menu.

First, the button needs to be bound to the menu–this can be done with aria-controls="theMenuID", aria-haspopup="true", and aria-expanded="true | false".

When the dropdown opens, focus should be sent to the first item (which needs tabindex="0") instead of the unordered list which has tabindex. Using the roving tabindex technique, only one item can be tabbable at a time when the menu is open. You've already got aria-activedescendant working, so the tabindex and focus management portions will get you part of the way there!

Hooking up the escape key to close the menu would be a nice addition, too.

tigar commented 4 years ago

I'm going to start taking a look at this. Coming here from ant.d component library and really wishing for better accessibility on this component.

yoyo837 commented 4 years ago

ref: #101