Skip to content
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

React Menu component doesn't allow tabbing away #1634

Closed
eriese opened this issue Jul 1, 2022 · 0 comments · Fixed by #1673
Closed

React Menu component doesn't allow tabbing away #1634

eriese opened this issue Jul 1, 2022 · 0 comments · Fixed by #1673
Assignees

Comments

@eriese
Copy link
Contributor

eriese commented Jul 1, 2022

What package within Headless UI are you using?

@headlessui/react

What version of that package are you using?

v1.6.5

What browser are you using?

N/A

Reproduction URL

[keyboard handling in menu component] (

case Keys.Tab:
event.preventDefault()
event.stopPropagation()
break
)

Describe your issue

According to the WAI ARIA spec, pressing tab or shift + tab while inside a menu should close the menu and move focus out. In the Headless UI code, tab is captured and prevented if the menu is open

Tab and Shift + Tab:
Move focus into a menubar:
If focus is moving into the menubar for the first time, focus is set on the first menuitem.
If the menubar has previously contained focus, focus is optionally set on the menuitem that last had focus. Otherwise, it is set on the first menuitem that is not disabled.
When focus is on a menuitem in a menu or menubar, move focus out of the menu or menubar, and close all menus and submenus.
Note that Tab and Shift + Tab do not move focus into a menu. Unlike a menubar, a menu is not visually persistent, and authors are responsible for ensuring focus moves to an item inside of a menu when the menu opens.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants