-
-
Notifications
You must be signed in to change notification settings - Fork 32.6k
[CardActionArea] Use div role="button" to facilitate interactive child elements #45130
Copy link
Copy link
Open
Labels
accessibilitya11ya11ybreaking changeIntroduces changes that are not backward compatible.Introduces changes that are not backward compatible.has workaroundThere’s a bug, but users have a complete workaround, so no urgent fix or release is needed.There’s a bug, but users have a complete workaround, so no urgent fix or release is needed.scope: cardChanges related to the card.Changes related to the card.type: enhancementIt’s an improvement, but we can’t make up our mind whether it's a bug fix or a new feature.It’s an improvement, but we can’t make up our mind whether it's a bug fix or a new feature.
Milestone
Metadata
Metadata
Assignees
Labels
accessibilitya11ya11ybreaking changeIntroduces changes that are not backward compatible.Introduces changes that are not backward compatible.has workaroundThere’s a bug, but users have a complete workaround, so no urgent fix or release is needed.There’s a bug, but users have a complete workaround, so no urgent fix or release is needed.scope: cardChanges related to the card.Changes related to the card.type: enhancementIt’s an improvement, but we can’t make up our mind whether it's a bug fix or a new feature.It’s an improvement, but we can’t make up our mind whether it's a bug fix or a new feature.
Projects
Status
In progress
Steps to reproduce
Steps:
<div>is placed inside a tag<button>, which does not comply to HTML5's specificationProblem:
http://www.w3.org/TR/2012/WD-html5-20120329/the-button-element.html#the-button-element says that a
<button>must contain only Phrasing content. Phrasing content is defined as including<span>but not<div>.Current behavior
<CardActionArea>when rendered becomes a<button>tag. If you add anything inside of it, e.g.<CardContent>or<Box>, it will happen that after rendering, you'll end up with a<button>tag, that has<div>inside of it.Expected behavior
All components from MUI should follow HTML5's validation rules, including
<CardActionArea>.Context
I was using MUI's
<Card>component, which had a<CardActionArea>component inside of it, with child components, such as<CardHeader>and<CardContent>, then I published my website to the server and tried to check for any HTML validation errors on https://validator.w3.org, which showed me errors related to<Card>component from MUI.Your environment
npx @mui/envinfoSearch keywords: W3C CardActionArea Card HTML5 SEO