Skip to content

[menu] Closing the menu with Tab doesn't restore focus to the trigger element #411

@m4theushw

Description

@m4theushw

Steps to reproduce

Link to live example: https://codesandbox.io/p/sandbox/unruffled-mirzakhani-8zvqrp?file=%2Fsrc%2FDemo.tsx

menu.webm

Current behavior

Pressing Tab closes the menu and, since it's portaled and there's no other element after it, the focus goes to <body>.

Expected behavior

The focus should return to the element that triggered the menu, like how Esc works.

Context

No response

Your environment

npx @mui/envinfo
  Don't forget to mention which browser you used.
  Output from `npx @mui/envinfo` goes here.

Search keywords: base menu tab

Search keywords:

Metadata

Metadata

Assignees

Labels

component: menuChanges related to the menu component.type: bugIt doesn't behave as expected.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions