-
-
Notifications
You must be signed in to change notification settings - Fork 31.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Tabs] Nested tabs cause console error #33606
Comments
Thanks for the report. Agree, it looks strange. Maybe we can update the condition for the warning to not do it if the whole tabs element is hidden, maybe something like this would be better: index 4dbc2a5dee..052b96a54b 100644
--- a/packages/mui-material/src/Tabs/Tabs.js
+++ b/packages/mui-material/src/Tabs/Tabs.js
@@ -359,7 +359,9 @@ const Tabs = React.forwardRef(function Tabs(inProps, ref) {
!warnedOnceTabPresent &&
tabMeta &&
tabMeta.width === 0 &&
- tabMeta.height === 0
+ tabMeta.height === 0 &&
+ // if the tab list element is hidden, don't warn
+ tabsMeta.clientWidth !== 0
) {
tabsMeta = null;
console.error( Would be great if we can cover these two scenarios with tests. Would you be interested in creating a PR for this? |
As long as it fixes the warning in the case I described, it's fine by me.
No, sorry - I have my own bugs to fix in react-admin! |
This one's getting me, too Here's my scenario:
Annoying because of the debug error messages dumped into console. But everything still works. |
I added commits to wrap up the PR: #34026 |
Duplicates
Latest version
Current behavior π―
Given the page contains a tab with tabs:
When the user switches to the second tab, MUI logs an error:
Expected behavior π€
No error π
Steps to reproduce πΉ
Context π¦
This bug appeared in react-admin, when a user tried to nest
<TranslatableInputs>
inside a<TabbedForm>
(marmelab/react-admin#7922)Your environment π
The text was updated successfully, but these errors were encountered: