Fix a11y issues in tabs component#609
Open
fateeand wants to merge 9 commits into
Open
Conversation
Coverage report for library
Test suite run success732 tests passing in 28 suites. Report generated by 🧪jest coverage report action from eb62b35 |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves accessibility for the tab group component by adding proper ARIA semantics, keyboard interaction support, focus styling, and updating the composition/docs tooling to reflect the new API and types.
Changes:
- Added ARIA roles/attributes and keyboard navigation (Arrow/Home/End + optional manual activation) to
cps-tab-group. - Migrated
cps-tabinputs/state to signals and introducedariaLabelto ensure tabs have an accessible name. - Updated docs/demo pages, API JSON generation, and Playwright a11y coverage for the tabs page.
Reviewed changes
Copilot reviewed 18 out of 19 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| projects/cps-ui-kit/src/lib/components/cps-tab-group/cps-tab/cps-tab.component.ts | Converts tab inputs to signal inputs; adds ariaLabel; updates active state handling. |
| projects/cps-ui-kit/src/lib/components/cps-tab-group/cps-tab/cps-tab.component.spec.ts | Adds unit tests for the new signal inputs and labeling validation behavior. |
| projects/cps-ui-kit/src/lib/components/cps-tab-group/cps-tab-group.component.ts | Adds IDs for tabs/panels, keyboard handling, focus/tabindex logic, and unique ID generation. |
| projects/cps-ui-kit/src/lib/components/cps-tab-group/cps-tab-group.component.spec.ts | Adds unit tests for ARIA wiring, keyboard behavior, and activation mode. |
| projects/cps-ui-kit/src/lib/components/cps-tab-group/cps-tab-group.component.scss | Improves focus-visible styling and converts many px values to rem for scalability. |
| projects/cps-ui-kit/src/lib/components/cps-tab-group/cps-tab-group.component.html | Adds tablist/tab/tabpanel roles, ARIA linking, and keyboard event bindings; refines markup. |
| projects/cps-ui-kit/src/lib/components/cps-sidebar-menu/cps-sidebar-menu.component.scss | Tweaks focus-ring offsets to align with updated focus styling. |
| projects/composition/src/app/pipes/detect-type.pipe.ts | Extends type detection to support arrays and unions via a structured return type. |
| projects/composition/src/app/pages/tab-group-page/tab-group-page.component.ts | Refactors tab demo data into arrays and adds checkbox demo content via templates. |
| projects/composition/src/app/pages/tab-group-page/tab-group-page.component.scss | Adjusts sizing to rem and adds padding for templated tab content. |
| projects/composition/src/app/pages/tab-group-page/tab-group-page.component.html | Refactors tab demos to use @for + ngTemplateOutlet; showcases manual activation. |
| projects/composition/src/app/components/service-docs-viewer/service-docs-viewer.component.html | Updates type-link rendering to use the new detectType return shape and adds type anchors. |
| projects/composition/src/app/components/component-docs-viewer/component-docs-viewer.component.html | Updates type-link rendering to use the new detectType return shape. |
| projects/composition/src/app/api-data/cps-timepicker.json | Normalizes string-literal union formatting. |
| projects/composition/src/app/api-data/cps-tab-group.json | Documents autoActivation and updates tab inputs to readonly/signal-style metadata. |
| projects/composition/src/app/api-data/cps-dialog.json | Updates documented types to reflect current API typings more accurately. |
| playwright/cps-accessibility.spec.ts | Re-enables Tabs coverage in Playwright accessibility suite with an updated selector. |
| api-generator/api-generator.js | Attempts to preserve source-level type annotations when generating API JSON. |
Playwright test resultsDetails
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixing accessibility issues in tabs component
Validation rules:
Validated using Playwright accessibility tests, Lighthouse tool, axe DevTools extension, Accessibility Insights for Web extension, 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
[N/A] Error Handling
Dynamic Content / Updates
Interaction Feedback / States
[N/A] Authentication & Sensitive Actions
Predictable & Controllable UI
Additional changes:
Updated the API generator to support compound prop types composed of a union between a custom type (with deeplink support to its section on the API pages) and other TS types. Previously, the custom type was ignored in such combinations, and only the remaining types were displayed.
Release notes: