Dropdown Component - Keyboard Navigation and accessibility
See original GitHub issue- I have searched the issues of this repository and believe that this is not a duplicate.
What problem does this feature solve?
The current implementation of Dropdown is not accessible for keyboard users.
Features that would improve keyboard navigation: escape key to close - when the menu is open pressing ESC to close the current dropdown arrow key nav - use up/down arrow keys to traverse options in the dropdown
What does the proposed API look like?
Adding a keydown handler to Dropdown similar to Cascader or Select:
handleKeyDown = (e: React.KeyboardEvent<HTMLInputElement>) => {
// SPACE => https://github.com/ant-design/ant-design/issues/16871
if (e.keyCode === KeyCode.BACKSPACE || e.keyCode === KeyCode.SPACE) {
e.stopPropagation();
}
};
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:5 (4 by maintainers)
Top Results From Across the Web
How to Create Drop-Down and Fly-Out Menus That Are Web ...
Accessible Drop-Down Menus for Keyboard Users ... Users who are reliant on a keyboard must be able to navigate your drop-down menus via...
Read more >Creating A Custom, Accessible Drop Down
A user can navigate list item elements with the up and down arrow keys, or the Tab key. A user can change the...
Read more >Accessibility in JavaScript DropDownList control - Syncfusion
Keyboard interaction ; Enter, Selects the focused item, and when it is in an open state the popup list closes. Otherwise, toggles the...
Read more >Fly-out Menus | Web Accessibility Initiative (WAI) - W3C
Use fly-out (or drop-down) menus to provide an overview of a web site's page hierarchy. It removes the need for multiple page loads...
Read more >html - How can i make a CSS drop down menu accessible for ...
I need to make an already existing CSS drop-down menu accessible for keyboard navigation. I got some progress in opening the drop-down menu...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
this isnt actually fixed by that PR. keyboard navigation works for regular menus but not for dropdowns
Fixed in https://github.com/ant-design/ant-design/pull/30382