fix(ColorPicker): add screen reader support for color announcements#3346
fix(ColorPicker): add screen reader support for color announcements#3346rivka-ungar wants to merge 6 commits intomasterfrom
Conversation
VoiceOver was unable to announce color names when navigating the color picker. Added aria-activedescendant, formatted aria-labels, and proper listbox/option roles so screen readers announce color names, selection state, and position. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Code Review by Qodo
|
.../src/components/ColorPicker/components/ColorPickerItemComponent/ColorPickerItemComponent.tsx
Outdated
Show resolved
Hide resolved
...ages/core/src/components/ColorPicker/components/ColorPickerContent/ColorPickerColorsGrid.tsx
Show resolved
Hide resolved
…pecial color strings Color values like `rgb(0, 0, 0)` contain characters invalid in HTML IDs, breaking aria-activedescendant. Use the color index instead. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Code Review by QodoNew Review StartedThis review has been superseded by a new analysisⓘ The new review experience is currently in Beta. Learn more |
…avioral changes Move aria-label back to Clickable (just with formatted name), keep onClick and onMouseDown on Clickable as before. The <li> only gets additive a11y attributes (role, id, aria-selected) with no behavioral changes. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Code Review by QodoNew Review StartedThis review has been superseded by a new analysisⓘ The new review experience is currently in Beta. Learn more |
|
📦 Bundle Size Analysis ✅ No bundle size changes detected. Unchanged Components
📊 Summary:
|
…" VoiceOver announcement The default role=button on Clickable inside role=option caused VoiceOver to announce "group". Setting role=presentation removes the nested interactive semantics without changing click behavior. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Persistent review updated to latest commit a9d3248 |
.../src/components/ColorPicker/components/ColorPickerItemComponent/ColorPickerItemComponent.tsx
Show resolved
Hide resolved
The aria-label now uses formatted names (e.g. "Bright Green" instead of "bright-green"), so the Storybook interaction tests need to match. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Persistent review updated to latest commit fe40661 |
| import { type ColorStyle } from "../../../../types"; | ||
|
|
||
| let colorPickerGridIdCounter = 0; | ||
| const generateColorPickerGridId = () => `color-picker-grid-${colorPickerGridIdCounter++}`; |
There was a problem hiding this comment.
Will 2 pickers in the same page have same id?
There was a problem hiding this comment.
The counter is global, same as we have with list
|
Persistent review updated to latest commit 649fdac |
|
A new prerelease version of this PR has been published! 🎉 |
1 similar comment
|
A new prerelease version of this PR has been published! 🎉 |
User description
Summary
aria-activedescendantto the color grid so VoiceOver announces the active color during keyboard navigationaria-labelfrom raw color values (done-green) to formatted names (Done Green)grid/gridcelltolistbox/optionfor proper color picker semanticsaria-selectedto each color option for selection state announcementsClickableinside each color itemrole="presentation"to avoid double screen reader announcementsListcomponent pattern) to support multiple ColorPickers on one pageMonday Task
https://monday.monday.com/boards/3532714909/pulses/11709234599
Test plan
selected/not selected)🤖 Generated with Claude Code
PR Type
Bug fix
Description
Enhanced ColorPicker screen reader support with proper ARIA attributes
aria-activedescendantfor active color announcementsgrid/gridcelltolistbox/optionfor semantic accuracyaria-selectedto indicate selection stateImplemented formatted color names in aria-labels (e.g., "Done Green" instead of "done-green")
Added unique ID generation per grid instance to support multiple ColorPickers
Set
role="presentation"on Clickable to prevent duplicate screen reader announcementsUpdated all tests to use formatted color names matching new aria-labels
Diagram Walkthrough
File Walkthrough
ColorPickerColorsGrid.tsx
Add ARIA attributes and ID generation to gridpackages/core/src/components/ColorPicker/components/ColorPickerContent/ColorPickerColorsGrid.tsx
useColorPickerGridIdhookgridtolistboxfor proper semanticsaria-activedescendantattribute to announce active colorColorPickerItemComponent
color strings
ColorPickerItemComponent.tsx
Add ARIA attributes and presentation role to itemspackages/core/src/components/ColorPicker/components/ColorPickerItemComponent/ColorPickerItemComponent.tsx
optionrolearia-selectedattribute to announce selection stateidprop for unique item identificationcolorAriaLabelprop for formatted color namesrole="presentation"to prevent nested role announcementsColorPicker.test.tsx
Update tests to use formatted color namespackages/core/src/components/ColorPicker/tests/ColorPicker.test.tsx
formatColorNameutility function to convert color strings totitle case
getByLabelTextcalls to use formatted color namesqueryByLabelTextcalls to use formatted color namesColorPicker.interactions.ts
Update interaction tests with formatted namespackages/docs/src/pages/components/ColorPicker/ColorPicker.interactions.ts
formatColorNameutility function for title case conversionclickOnColorfunction to use formatted color names in labellookup