[RFC] Chip markup
See original GitHub issueRegarding https://material-ui.com/components/chips/#chip-2
Problem
Chips currently have both a bad a11y and UX story:
- delete action is inaccessible on iOS devices (and requires knowledge of keyboard shortcuts in any other screen reader)
- deleteable Chips are announced as buttons
- clicking the delete icon triggers the same ripple as clicking the Chip itself. The ripple shouldn’t bubble to elements that are not activated.
- a deleteable button is by default selectable but not a basic Chip. Why?
- demos illustrates a trailing icon that is not used as the delete action. Having it trigger onDelete is misleading (adressed in #16097)
Current implementation
This uses terminology from the accessibility tree. A <button>
does not necessarily represent a HTMLButtonElement
- Basic:
<generic tabindex="-1">Basic</generic>
- clickable:
<button>Clickable</button>
- deleteable:
<button>Deleteable <SVGRoot aria-hidden="true" focusable="false">...</SVGRoot></button>
- deletable + clickable:
<button tabindex="0">Clickable deleteable <SVGRoot aria-hidden="true" focusable="false">...</SVGRoot></button>
Proposal
- don’t nest interactive elements
- whether the delete action should be in tab order is a hard question. I lean towards having it in tab order and making it easily customizale (for grid-like implementations or Autocomplete)
Basic
-<generic tabindex="-1">Basic</generic>
+<generic>Basic</generic>
Clickable
These are fine.
deleteable
-<button>Deleteable <SVGRoot aria-hidden="true" focusable="false">...</SVGRoot></button>
+<generic>Deleteable<button><SVGRoot>...</SVGRoot></button></generic>
deletable + clickable
-<button tabindex="0">Clickable deleteable <SVGRoot aria-hidden="true" focusable="false">...</SVGRoot></button>
+<generic><button tabindex="0">Clickable deleteable</button><button tabindex="0"><SVGRoot aria-hidden="true" focusable="false">...</SVGRoot></button></generic>
Context
Issue Analytics
- State:
- Created 3 years ago
- Reactions:9
- Comments:7 (4 by maintainers)
Top Results From Across the Web
[RFC] Chip markup - - Bountysource
Regarding https://material-ui.com/components/chips/#chip-2. Problem. Chips currently have both a bad a11y and UX story: delete action is inaccessible on iOS ...
Read more >Version 2 Requirements (RFC 3505) - IETF
It includes requirements as they relate to Extensible Markup Language (XML) syntax, data model, format, and payment processing. Table of Contents 1.
Read more >Everything You Need To Know Before Getting An RFID Implant
Are you ready for an RFID implant? Here's everything what you should know about RFID chips before you implant them into your body....
Read more >How much does an RFID tag cost today?
A passive 96-bit EPC inlay (chip and antenna mounted on a substrate) costs from 7 to 15 U.S. cents. If the tag is...
Read more >UHF RFID Chip TID
UHF RFID Chip Short TID · UHF RFID Chip Extended TID · UHF RFID Chip Manufacturer Code · UHF RFID Chip Tag Model...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@eps1lon What do you think if we introduce
ChipButton
specifically for the clickable chips? Because at any point, it is either non-clickable or clickable (it reminds me of the<ListItem button>
case)Also get rid of the
deletable
prop in favor ofstart/endDecorator
+ChipDelete
component (A small component that provides the built-in close icon which developers can change the icon via theming).For clickable + deletable chip, use
Chip
that contains a button inside:This will match the markup in your comment
I’m running into this when I see that
delete
button is really tricky to test with testing-library. The new implementation seams very interesting 💯