fix(a11y): add accessible labels to icon-only controls#50
fix(a11y): add accessible labels to icon-only controls#50mattrothenberg merged 2 commits intocloudflare:mainfrom
Conversation
commit: |
Docs PreviewCommit: |
geoquant
left a comment
There was a problem hiding this comment.
Thanks for the contribution — the a11y gaps you identified are real and the fix direction is correct. Merge conflict is now resolved. A few changes needed before this can land:
1. Make labels configurable props (per @mattrothenberg's feedback)
Hardcoded English strings prevent i18n. Each label should be a prop with an English default.
TriggerInput:
function TriggerInput({
clearLabel = "Clear selection",
showOptionsLabel = "Show options",
...props
}: ComboboxBase.Input.Props & {
/** Accessible label for the clear button. @default "Clear selection" */
clearLabel?: string;
/** Accessible label for the dropdown trigger. @default "Show options" */
showOptionsLabel?: string;
}) {
// ...
<ComboboxBase.Clear aria-label={clearLabel} ...>
<ComboboxBase.Trigger aria-label={showOptionsLabel} ...>
}Chip:
function Chip({
removeLabel = "Remove",
...props
}: ComboboxBase.Chip.Props & {
/** Accessible label for the chip remove button. @default "Remove" */
removeLabel?: string;
}) {
// ...
<ComboboxBase.ChipRemove aria-label={removeLabel} ...>
}2. Chip label wording
Change "Remove selection" → "Remove". In chip context, the chip is the selection — "Remove selection" is ambiguous when there are multiple chips.
3. MenuBar — looks good as-is
aria-label={tooltip} on the icon-only button is correct and necessary — the Tooltip component provides aria-describedby (supplementary), not aria-label (name). No change needed here.
6be6e8b to
d0456dd
Compare
|
/bonk please review |
There was a problem hiding this comment.
LGTM! The changes address all the accessibility concerns and incorporate the feedback from previous reviews.
Summary of changes:
-
Combobox.TriggerInput - Added
clearLabelandshowOptionsLabelprops with sensible English defaults ("Clear selection", "Show options") and JSDoc comments noting i18n support -
Combobox.Chip - Added
removeLabelprop with default "Remove" (updated from "Remove selection" per feedback) -
MenuBar - Added
aria-label={tooltip}to icon-only buttons, which correctly uses the tooltip text as the accessible name
The implementation follows Kumo conventions:
- Props have descriptive JSDoc with
@defaultvalues - Default strings are translatable via prop overrides
- Uses semantic tokens and proper compound component patterns
All icon-only controls now have proper accessible labels for screen readers.
|
I reviewed PR #50 by fetching the diff and reading the changed files (combobox.tsx, menubar.tsx, and changeset). After verifying the changes addressed all accessibility concerns and incorporated previous reviewer feedback (making labels configurable props with English defaults for i18n support), I submitted an approving review via the GitHub API. |
stritt
left a comment
There was a problem hiding this comment.
looks good, thanks for making the labels configurable 👍
e20e2b5 to
ea8bb17
Compare


















Description
MenuBarandComboboxProblem
Several icon-only controls were missing explicit accessible labels, so screen readers could announce them as unlabeled buttons.
Controls:
MenuBaroption buttons (icon-only)Combobox.TriggerInputclear buttonCombobox.TriggerInputdropdown trigger buttonCombobox.ChipRemovebutton in multi-select chipsSolution
Add
aria-labelto each icon-only control:MenuBar: Uses thetooltipprop as the aria-label (consumer-provided)Combobox.TriggerInput: NewclearLabelandshowOptionsLabelprops with English defaultsCombobox.ChipRemove: NewremoveLabelprop with English defaultAll labels are customizable for i18n.