Skip to content
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] Fix invalid HTML inside heading #44408

Open
wants to merge 35 commits into
base: master
Choose a base branch
from

Conversation

ZeeshanTamboli
Copy link
Member

@ZeeshanTamboli ZeeshanTamboli commented Nov 14, 2024

Fixes #44153

This PR resolves a regression introduced in #42914 by making the following changes to ensure valid HTML structure for the Accordion component:

  • Changed the Accordion summary element to button.
  • Updated the Accordion summary content and icon wrapper elements to span.

Additionally, typography has been removed from the demos since the p element rendered by Typography is invalid inside a span. Typography styles are now applied directly to the summary button using theme.typography.body1, making the extra Typography component unnecessary.

Breaking Change

  • The structure of the Accordion summary has been updated:
    • The root element is now a button.
    • Summary content and the icon wrapper are rendered as span.
  • Developers using the previous div element for styling in the AccordionSummary should update their styling. Additionally, those using Typography, which defaults to rendering a p tag, should replace it with a span or remove it for valid HTML, as shown in the updated demos.

These changes are critical to fix the regression but introduce a breaking change. IMO, this should be released in a minor version (v6.x) and documented in the migration guide. I know this is not ideal but the fix is also important.


If approved, I’ll include a note in the migration guide detailing these changes.

@ZeeshanTamboli ZeeshanTamboli added the component: accordion This is the name of the generic UI component, not the React module! label Nov 14, 2024
@mui-bot
Copy link

mui-bot commented Nov 14, 2024

Netlify deploy preview

https://deploy-preview-44408--material-ui.netlify.app/

Bundle size report

Details of bundle changes (Toolpad)
Details of bundle changes

Generated by 🚫 dangerJS against 6996b27

@oliviertassinari oliviertassinari changed the title [material-ui][Accordion] Fix invalid HTML inside heading [Accordion] Fix invalid HTML inside heading Nov 15, 2024
@ZeeshanTamboli ZeeshanTamboli added bug 🐛 Something doesn't work breaking change package: material-ui Specific to @mui/material regression A bug, but worse labels Nov 18, 2024
@ZeeshanTamboli ZeeshanTamboli marked this pull request as ready for review November 18, 2024 08:44
@github-actions github-actions bot added the PR: out-of-date The pull request has merge conflicts and can't be merged label Nov 18, 2024
@github-actions github-actions bot removed the PR: out-of-date The pull request has merge conflicts and can't be merged label Nov 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking change bug 🐛 Something doesn't work component: accordion This is the name of the generic UI component, not the React module! package: material-ui Specific to @mui/material regression A bug, but worse
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[material-ui][Accordion] Default Accordion now uses div's nested within a heading tag, which is invalid HTML
2 participants