Skip to content

[card] Actionable card improvements#48105

Draft
silviuaavram wants to merge 7 commits intomui:masterfrom
silviuaavram:feat/card-improvements
Draft

[card] Actionable card improvements#48105
silviuaavram wants to merge 7 commits intomui:masterfrom
silviuaavram:feat/card-improvements

Conversation

@silviuaavram
Copy link
Copy Markdown
Member

@silviuaavram silviuaavram commented Mar 26, 2026

Fixes #45130

A card's primary action is related to its main subject: the heading. The primary action is to expand the subject in the heading, either by navigating through a link, or executing an action. For this reason, Card accepts href and onClick, which render the CardHead heading inside a link / button element. This element is focusable, and its focus style is reflected on the whole card. The card can also have other focusable elements in CardHeader, CardContent and CardActions. By default, CardActions, in this case, will render a visual indicating "Read more" element, but that could be customized or removed via slots.

Accessibility:

  • all focusable elements are reachable, main action is executed when clicking on the whole card.
  • all focusable elements are in the tab order.
  • aria-description on the button/link to "read more".

https://www.youtube.com/watch?v=iIoHdxmC8eM&t=396s
https://inclusive-components.design/cards/#thepseudocontenttrick

@mui-bot
Copy link
Copy Markdown

mui-bot commented Mar 26, 2026

Netlify deploy preview

Bundle size report

Bundle Parsed size Gzip size
@mui/material 🔺+2.05KB(+0.41%) 🔺+557B(+0.39%)
@mui/lab 0B(0.00%) 0B(0.00%)
@mui/system 0B(0.00%) 0B(0.00%)
@mui/utils 0B(0.00%) 0B(0.00%)

Details of bundle changes

Generated by 🚫 dangerJS against fe8a966

});

const { className, raised = false, ...other } = props;
const { className, raised = false, href, onClick, ...other } = props;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Supporting both link (via href) and "button-like" (via implicit "onClick without href") creates annoying TS issues similar to what ButtonBase suffers, and makes it easy to create accessibility failures

Chip, like Card is also a thing that can be static, a link, or a clickable button(-like), I think we should align their APIs

What do you think about #48015 (comment)? @silviuaavram

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree about the V2 part, this way we avoid any confusion.

@zannager zannager added the scope: card Changes related to the card. label Apr 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope: card Changes related to the card.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[CardActionArea] Use div role="button" to facilitate interactive child elements

4 participants