autoFocus on menuItem doesn't focus on menu open via click
Open
@mnajdova is already working on this.
Since Mar 16, 2023.
scope: menu
- Dominant language
- JavaScript
- Stars
- 99.1k
- Forks
- 32.5k
- Avg merge
- 2d 17h
- Merged PRs (30d)
- 106
Description
Steps to reproduce 🕹
Link to live example: https://codesandbox.io/s/blissful-kare-sokg13?file=/demo.tsx
Steps:
- Click dashboard button
- First menu item should be focused
Current behavior 😯
First menu item is focused (see console), but focus styling and class is not applied.
Expected behavior 🤔
First menu item has focus styling and class applied
Context 🔦
I'm trying show the user which menu item is focussed on menu open.
This may change based on which item I have applied autoFocus to
If you click and drag on the button, but do not click on it directly, and then press enter it does focus as expected.
Your environment 🌎
npx @mui/envinfo
System:
OS: macOS 12.2.1
Binaries:
Node: 19.6.0 - ~/.volta/tools/image/node/19.6.0/bin/node
Yarn: 1.22.18 - ~/.volta/tools/image/yarn/1.22.18/bin/yarn
npm: 9.4.0 - ~/.volta/tools/image/node/19.6.0/bin/npm
Browsers:
Chrome: 111.0.5563.64
Edge: Not Found
Firefox: 110.0.1
Safari: 15.3
npmPackages:
@emotion/react: ^11.10.6 => 11.10.6
@emotion/styled: ^11.10.6 => 11.10.6
@mui/base: 5.0.0-alpha.121
@mui/core-downloads-tracker: 5.11.13
@mui/icons-material: ^5.11.11 => 5.11.11
@mui/material: ^5.11.13 => 5.11.13
@mui/private-theming: 5.11.13
@mui/styled-engine: 5.11.11
@mui/system: 5.11.13
@mui/types: 7.2.3
@mui/utils: 5.11.13
@types/react: ^18.0.28 => 18.0.28
react: ^18.2.0 => 18.2.0
react-dom: ^18.2.0 => 18.2.0
typescript: ^5.0.1-rc => 5.0.1-rc
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.