-
-
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
[RFC] Chip markup #20470
Comments
I'm running into this when I see that |
So having spent a sleepless night worrying about accessibility of chips in my app, I think that the issue is in how the Material Design language for Chips has been interpreted here. Things I have noticed:
So basically, Chips only have a delete button when they are text inputs, and normally the user wants to have the option to edit or delete the entered input when keyboard focussing on the Chip. |
@eps1lon What do you think if we introduce <Chip>text</Chip> // simple chip, renders `div`
<ChipButton>text</ChipButton> // clickable chip, renders `button`
<ChipButton component={Link}>text</ChipButton> // renders `a` Also get rid of the <Chip endDecorator={<DeleteIcon />}>text</Chip> // simple chip with icon
<Chip endDecorator={<ChipDelete />}>text</Chip> // simple chip with delete button
<Chip endDecorator={<ChipDelete icon={<Trash />} />}>text</Chip> // simple chip with delete button (custom delete icon) For clickable + deletable chip, use <Chip endDecorator={<ChipDelete onClick={...} />}><button>Text</button></Chip> This will match the markup in your comment |
Any momentum on this issue? Running into the same problem currently. Looks like the current implementation of the chip probably shouldn't be used outside of a text field. I would be all for adding an end decorator or a seperate component for chips that are to be used outside a text field. The current implementation blocks the accessibility needs of anyone interacting with this component.
|
@CalebJamesStevens Could you take a look at Joy UI Chip? If it looks good to you, we might update Material UI Chip to follow the similar structure.
We could add this to the |
https://mui.com/joy-ui/react-chip/#clickable This is perfect, if it could be added to mui material that would be amazing |
<Box
aria-hidden
className={classes.hiddenTagDescription}
id={`${tag}-description`}
>
You are current on a list item with the value of {tag}. To delete the list item press the backspace button.
</Box>
<Chip
aria-describedby={`${tag}-description`}
> For those stumbling upon this and waiting for the update this is the accessible solution I had where i made the div insivible but had it describe the chip for a screan reader |
Was there a plan to have this functionality added? We are being audited by a large national bank and they noted this issue and an accessibility issue |
@DiegoAndai What do you think about the current Joy UI approach? Should we collab on this to bring it to Material UI? |
Hey! Yes, we created an issue for getting closer to Joy's approach: #39171. We'll try to get as close as possible without significant breaking changes. I'll add this RFC to that issue. |
Regarding https://material-ui.com/components/chips/#chip-2
Problem
Chips currently have both a bad a11y and UX story:
Current implementation
This uses terminology from the accessibility tree. A
<button>
does not necessarily represent aHTMLButtonElement
<generic tabindex="-1">Basic</generic>
<button>Clickable</button>
<button>Deleteable <SVGRoot aria-hidden="true" focusable="false">...</SVGRoot></button>
<button tabindex="0">Clickable deleteable <SVGRoot aria-hidden="true" focusable="false">...</SVGRoot></button>
Proposal
Basic
Clickable
These are fine.
deleteable
deletable + clickable
Context
#17708
Closes #19468
The text was updated successfully, but these errors were encountered: