[Tabs] Improve TabPanel demos, avoid validateDOMNesting warning
See original GitHub issue- The issue is present in the latest release.
- I have searched the issues of this repository and believe that this is not a duplicate.
Current Behavior 😯
New experimental Tabs API uses <Typography>
as the root element for children, preventing nesting anything besides simple text without validateDOMNesting
errors. See here: https://github.com/mui-org/material-ui/blob/8c2abebab524a68e97ffb5cf0c2015a915bd2e12/packages/material-ui-lab/src/TabPanel/TabPanel.js#L36
Expected Behavior 🤔
I believe that removing <Typography>
completely and rendering children directly would be the best solution with maximum flexibility.
Context 🔦
Will sent a PR if you agree with the solution.
Your Environment 🌎
Tech | Version |
---|---|
Material-UI | v4.9.13 |
Material-UI lab | v4.0.0-alpha.53 |
React | 16.13.1 |
Issue Analytics
- State:
- Created 3 years ago
- Reactions:14
- Comments:19 (7 by maintainers)
Top Results From Across the Web
[Tabs] Improve TabPanel demos, avoid validateDOMNesting ...
I am on v5 and still needed to tell a Typography explicitly to be a span, otherwise I got this "avoid validateDOMNesting warning"...
Read more ><div> cannot appear as a descendant of <p> - Stack Overflow
The warning appears only because the demo code has: function TabPanel(props) { const { children, value, index, ...other } = props; ...
Read more >validatedomnesting(...): <div> cannot appear as a descendant ...
I was applying the change in the wrong place. After adding component={"div"} in the TabPanel function, it started working as well. The working...
Read more ><div> cannot appear as a descendant of <p>. tab panel” Code ...
Answers related to “validateDOMNesting(...): <div> cannot appear as a descendant of <p>. tab panel”. JSX element implicitly has type 'any' because no ...
Read more >[Solved]-<div> cannot appear as a descendant of <p>-Reactjs
The warning appears only because the demo code has: function TabPanel(props) { const { children, value, index, ...other } = props; return (...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Note: the warning appears only because the demo code has:
Changing it like this takes care of it:
Yes that fixed it for me thanks a lot. As you said the demo code should probably be updated.