question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

5reactions
codewitchcommented, Jul 16, 2021

this isnt actually fixed by that PR. keyboard navigation works for regular menus but not for dropdowns

0reactions
afc163commented, Jun 1, 2021
Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found