`autoFocus` not working when `Textfield` is mounted by clicking on the `MenuItem` within `Menu`
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- react, typescript
- Domain
- frontend
Research direction
Reproduce the behavior in the linked CodeSandbox, starting with demo.tsx and the Menu, MenuItem, Toggle, and Textfield interaction. Compare autofocus when the Textfield is toggled directly versus mounted from the Menu. Done means the Textfield receives focus in both cases, with the behavior verified against the provided reproduction.
Written by the indexing model from the issue text.
Description
Duplicates
- I have searched the existing issues
Latest version
- I have tested the latest version
Steps to reproduce 🕹
Link to live example:
Steps:
- Go to https://codesandbox.io/s/magical-fog-y0e1m1?file=/demo.tsx
- Click on the
ToggleButton - The
autoFocusis working as expected. - Click on the
ToggleButton again to hide the Textfield - Click on
Open MenuButton - Click on the
Togglewithin the Menu - The
autoFocusis not working
Current behavior 😯
It is not autoFocus the Textfield.
Expected behavior 🤔
It is autoFocus the Textfield.
Context 🔦
I have a form that will open after clicking on the option in the Menu. I want it to autoFocus the Textfield when the form is open.
Your environment 🌎
npx @mui/envinfo
I am using Edge.
System:
OS: Windows 10 10.0.22621
Binaries:
Node: 18.12.1 - C:\Program Files\nodejs\node.EXE
Yarn: Not Found
npm: 8.19.2 - C:\Program Files\nodejs\npm.CMD
Browsers:
Chrome: Not Found
Edge: Spartan (44.22621.1194.0), Chromium (109.0.1518.70)
npmPackages:
@emotion/react: ^11.10.5 => 11.10.5
@emotion/styled: ^11.10.5 => 11.10.5
@mui/base: 5.0.0-alpha.113 => 5.0.0-alpha.113
@mui/core-downloads-tracker: 5.11.4
@mui/icons-material: ^5.11.0 => 5.11.0
@mui/material: ^5.11.4 => 5.11.4
@mui/private-theming: 5.11.2
@mui/styled-engine: 5.11.0
@mui/system: ^5.11.4 => 5.11.4
@mui/types: 7.2.3
@mui/utils: 5.11.2
@mui/x-data-grid: 5.17.19
@mui/x-data-grid-premium: ^5.17.19 => 5.17.19
@mui/x-data-grid-pro: 5.17.19
@mui/x-date-pickers: 5.0.14
@mui/x-date-pickers-pro: 5.0.14 => 5.0.14
@mui/x-license-pro: 5.17.12
@types/react: ^18.0.26 => 18.0.26
react: ^18.2.0 => 18.2.0
react-dom: ^18.2.0 => 18.2.0
typescript: ^4.9.4 => 4.9.4
- Dominant language
- JavaScript
- Stars
- 99.1k
- Forks
- 32.5k
- Avg merge
- 2d 17h
- Merged PRs (30d)
- 106
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.
More from mui/material-ui
-
type: new feature waiting for 👍
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
mui/material-ui#48254 · 3 comments · 1 reaction ·
-
has workaround scope: avatar waiting for 👍
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
mui/material-ui#48190 · 5 comments ·
-
has workaround scope: typography type: new feature waiting for 👍
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
mui/material-ui#46488 · 2 comments · 1 reaction ·
-
has workaround scope: text field type: bug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
mui/material-ui#37216 · 6 comments ·
-
docs scope: autocomplete
Difficulty 1/5 1-3 hours Newbie friendliness 68/100
mui/material-ui#35713 · 5 comments ·
Similar issues
-
code-quality refactoring
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
github/gh-aw-firewall#8816 ·
-
integration:quickjs org:external priority:backlog topic:code-interpreter topic:middleware type:feature
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
langchain-ai/deepagents#6450 ·
-
optimization optimization:agents-md-curator
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
githubnext/gh-aw-cao#13143 ·
-
status: needs triage
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100