Fix a11y issues in autocomplete and chip components#526
Fix a11y issues in autocomplete and chip components#526
Conversation
Coverage report for library
Test suite run success419 tests passing in 21 suites. Report generated by 🧪jest coverage report action from e8691b4 |
Playwright test resultsDetails
|
There was a problem hiding this comment.
Pull request overview
This PR improves accessibility compliance for the UI kit’s Autocomplete and Chip components by updating ARIA semantics, keyboard interactions, focus styling, and contrast-related colors, with supporting composition/demo updates.
Changes:
- Add ARIA roles/attributes and keyboard interaction support to
cps-autocompleteandcps-chip. - Improve focus styles and contrast by adjusting text colors and converting several sizing values to
rem. - Update composition/demo pages and API metadata to reflect new/updated props and color tokens.
Reviewed changes
Copilot reviewed 14 out of 15 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| projects/cps-ui-kit/styles/_colors.scss | Tweaks text color token values and adds --cps-color-text-medium for improved contrast. |
| projects/cps-ui-kit/src/lib/utils/internal/accessibility-utils.ts | Adds internal helpers for unique IDs and computed aria-label text. |
| projects/cps-ui-kit/src/lib/components/cps-select/cps-select.component.ts | Adjusts virtual scroll item size. |
| projects/cps-ui-kit/src/lib/components/cps-icon/cps-icon.component.scss | Converts icon sizes from px to rem. |
| projects/cps-ui-kit/src/lib/components/cps-chip/cps-chip.component.ts | Adds close button aria-label input and prevents close interaction when disabled. |
| projects/cps-ui-kit/src/lib/components/cps-chip/cps-chip.component.scss | Updates chip spacing/sizing and adds focus-visible styling for the close icon. |
| projects/cps-ui-kit/src/lib/components/cps-chip/cps-chip.component.html | Adds ARIA labeling and keyboard interaction to the close icon. |
| projects/cps-ui-kit/src/lib/components/cps-autocomplete/cps-autocomplete.component.ts | Adds ARIA/ID plumbing, improves blur/focus behavior, and adds arrow navigation support for virtual scroll. |
| projects/cps-ui-kit/src/lib/components/cps-autocomplete/cps-autocomplete.component.scss | Updates styles for focus/active/opened states and multi-selection layout. |
| projects/cps-ui-kit/src/lib/components/cps-autocomplete/cps-autocomplete.component.html | Adds combobox/listbox semantics, active-descendant wiring, and keyboard support for clear/chevron actions. |
| projects/composition/src/app/pages/colors-page/colors-page/colors-page.component.ts | Updates demo color grouping to include the new text-medium token. |
| projects/composition/src/app/pages/autocomplete-page/autocomplete-page.component.html | Converts a demo width value to rem. |
| projects/composition/src/app/api-data/cps-chip.json | Documents the new closeButtonAriaLabel prop. |
| package.json | Reorders/adds dev dependency entry for @axe-core/playwright. |
| package-lock.json | Updates resolved dependency versions; includes an extraneous package entry that should be cleaned up. |
projects/cps-ui-kit/src/lib/components/cps-autocomplete/cps-autocomplete.component.html
Outdated
Show resolved
Hide resolved
projects/cps-ui-kit/src/lib/components/cps-autocomplete/cps-autocomplete.component.html
Show resolved
Hide resolved
projects/cps-ui-kit/src/lib/components/cps-autocomplete/cps-autocomplete.component.scss
Show resolved
Hide resolved
There was a problem hiding this comment.
Great work! Please see my other comment regarding the optionInfo.
Since a11y was fixed for Autocomplete and Chip here, feels like a good time to turn on a11y Playwright checks in CI for them to avoid regressions (if it’s just a one‑liner, maybe we can add it in this PR).
Fixing accessibility issues in Autocomplete and Chip components
Validation rules:
Validated using Playwright accessibility tests, Lighthouse tool, and manual checks including keyboard tab navigation and screen reader testing.
Full doc with rules
Playwright axe-core validation results:
State before:
State after:
Checklist
Keyboard Navigation
All interactive elements are fully operable via keyboard only, including buttons, inputs, menus, dialogs, sliders, drag-and-drop, tree views, multi-selects, and composite widgets. No traps or dead ends.
Focus Management
Focus is visible, logical, moves in predictable order, trapped where necessary (modals/popovers), and restored after closing. Focus is perceivable in all interactive widgets.
Semantics / ARIA
Color / Contrast
Screen Reader / Assistive Technology
Responsive & Zoom
Error Handling
Dynamic Content / Updates
Interaction Feedback / States
Authentication & Sensitive Actions
Predictable & Controllable UI
Release notes: