-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
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
[Accordion] Fix invalid HTML inside heading #44408
Conversation
Netlify deploy previewBundle size reportDetails of bundle changes (Toolpad) |
How to do that? That's what I did by spreading |
I'm a bit lost. This is the option I think we should go for:
Why, then, are the typography styles not applied if we're still using the |
@DiegoAndai See this sentence: This forces the user to always use a Typography component for styling the summary text. |
But this was the case previously as well, isn't it? This is why we have Incidentaly, the first demo doesn't use In contrast, here's on of the demos that use |
Maybe we could:
And release that as a minor. Would that fix the issue? cc: @aarongarciah |
I've made the changes. The first demo no longer uses Typography, so Argos CI flagged the change (aside from the flaky progress component test). I wasn't aware the first demo differed between CodeSandbox and the docs, but now they're the same. The docs theme isn't applied—is that okay? I think it is because the HTML button styles are applied, as shown in the screenshot: This PR: https://deploy-preview-44408--material-ui.netlify.app/material-ui/react-accordion/#introduction I've also pushed a commit to fix in the Marketing page template: db65312 |
@ZeeshanTamboli can you update the first demo to include the |
@aarongarciah Updated. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Thanks for your patience.
@ZeeshanTamboli I think only 2 things are missing:
- Add an entry in the migration guide explaining the change.
- Update the PR description to reflect the latest changes in the PR.
In the next release, we'll explain the change, too.
Updated |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM ✅
As always, @ZeeshanTamboli, thanks for working on this and willingness to discuss approaches to get the best solution for the community.
Let's wait for a final review from @aarongarciah.
CC: @mnajdova for next week's release: this requires a minor bump and a mention on the CHANGELOG. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
Some thoughts about this being "breaking" or not This should be considered a fix and not a breaking change. It doesn't change any of our public APIs. Imagine a function that doesn't work as expected, and we fix it (without changing the public API). Users who accounted for the previous (broken) behavior might perceive it as a breaking change. Users who expect the new (fixed) behavior perceive it as a fix. This is the same. I agree it's an edge case. Releasing it in a minor version with an explanation of how to adapt is a good compromise between both. We need to be able to make these compromises to move forward. Besides, I wouldn't consider the tags as public API, which is what Semver uses to classify something as breaking. That's not to say we should change them without caution, but we should be able to do it when necessary. I'm removing the "breaking" label and instead naming it "minor version change". I also updated the PR's description accordingly. |
Fixes #44153
This PR resolves a regression introduced in #42914 by making the following changes to ensure valid HTML structure for the Accordion component:
button
.span
.Typography
on the demos as before, but withcomponent='span'
since thep
element rendered by Typography is invalid inside aspan
.Minor version change
button
(previouslydiv
).span
(previouslydiv
).How might this impact you:
div
element for styling in the AccordionSummary should update their styling.How to fix similar invalid HTML in your codebase
Part of this PR is fixing invalid HTML in our demos. If you copied code from these demos in the past, you might have to do similar changes to your codebase.
If you are using
Typography
inside theAccordionSummary
, which defaults to rendering ap
tag, you should use thecomponent
prop to replace the HTML tag as such:<Typography component="span" />
, 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.