[Tooltip] `The children component of the Tooltip is not forwarding its props correctly` error when focusing another element
@siriwatknp is already working on this.
Since Aug 22, 2022.
- Dominant language
- JavaScript
- Stars
- 99.1k
- Forks
- 32.5k
- Avg merge
- 2d 17h
- Merged PRs (30d)
- 106
Description
Duplicates
- I have searched the existing issues
Latest version
- I have tested the latest version
Current behavior 😯
In the demo in https://mui.com/x/react-data-grid/editing/#validation, we wrap a InputBase into a Tooltip to show the validation error. The problem is that as soon as the user enters the edit mode (double-clicking the cell), we imperatively call inputRef.current.focus() to focus the input and this generates the following error:
The
childrencomponent of the Tooltip is not forwarding its props correctly.
The problem seems to come from https://github.com/mui/material-ui/blob/6e69c8e8db54305f7602e11ea76b9b13adcf04cd/packages/mui-material/src/Tooltip/Tooltip.js#L425-L429
childNode initially has the correct element —the immediate child of Tooltip—, but when .focus is called, childNode becomes the input, which falls in
Expected behavior 🤔
No error in the console.
Steps to reproduce 🕹
Steps:
- Open https://codesandbox.io/s/magical-brahmagupta-xgisfp?file=/src/App.tsx
- Click "Toggle input"
- Look at the console
Context 🔦
Related to https://github.com/mui/mui-x/issues/5457
Your environment 🌎
npx @mui/envinfo
Don't forget to mention which browser you used.
Output from `npx @mui/envinfo` goes here.
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.