-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
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
[Accordion] AccordionSummary button validateDOMNesting warning #45187
Comments
Can you provide an example of what you are trying to achieve? Codesandbox/Stackblitz example would be great. Are you trying to customze the |
@orenBerko However to make it render a div instead you can use the <AccordionSummary component="div" role="button" /> (disclaimer: this is terrible for accessibility, interactive elements should never be nested) |
This comment has been minimized.
This comment has been minimized.
@mj12albert the component is not a member of AccordionSummary so you solution not work for me @mnajdova FYI |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
@orenBerko Sorry I misread this, the component prop works, the props of ButtonBase are also available on AccordionSummary, see the line/link under this heading: https://mui.com/material-ui/api/accordion-summary/#props Sandbox: https://codesandbox.io/p/sandbox/goofy-sky-fccdx8-fccdx8?file=%2Fsrc%2FDemo.tsx%3A18%2C29-20%2C24 DISCLAIMER: this may pass html validators but it's terrible for a11y, interactive elements like buttons should never be nested: https://adrianroselli.com/2016/12/be-wary-of-nesting-roles.html |
👋 Thanks for using this project! We use GitHub issues exclusively as a bug and feature requests tracker, however, this issue appears to be a support request. For support with Material UI please check out https://mui.com/material-ui/getting-started/support/. Thanks! If you have a question on Stack Overflow, you are welcome to link to it here, it might help others. |
Steps to reproduce
Steps:
Current behavior
the accordion Summary is html button and in my add i add buttons inside the summary and i get this warning:
validateDOMNesting(...): cannot appear as a descendant of . Error Component Stack
after investigation i see that the summary is MuiButtonBase-root and this is the problem button inside buttons
in the previous version did not have this error
Expected behavior
i think you need an option to change the container to be div or something else from button
Context
No response
Your environment
npx @mui/envinfo
Search keywords: Accordion,Summary
The text was updated successfully, but these errors were encountered: