feat: fix a11y issues in expansion panel component#654
Open
fateeand wants to merge 3 commits into
Open
Conversation
Contributor
Coverage report for library
Test suite run success1125 tests passing in 33 suites. Report generated by 🧪jest coverage report action from d723743 |
Contributor
Playwright test resultsDetails
|
lukasmatta
reviewed
Jun 9, 2026
Collaborator
There was a problem hiding this comment.
Suggested change
| export class CpsExpansionPanelComponent | |
| implements OnInit, AfterViewInit, OnChanges |
| this.cvtWidth = convertSize(this.width); | ||
| } | ||
|
|
||
| this._logHeaderTitleError(); |
Collaborator
There was a problem hiding this comment.
maybe this can be also guarded under if (changes.headerTitle)
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves the accessibility of CpsExpansionPanelComponent by adding proper ARIA semantics, keyboard interaction handling, and focus styling, and then re-enables automated Playwright axe validation for the expansion panel example page.
Changes:
- Add ARIA roles/attributes (
role="button",aria-expanded,aria-controls,aria-hidden) and keyboard handlers to the expansion panel header/content. - Update styling to include an accessible focus ring and switch several hard-coded
pxvalues torem. - Expand unit test coverage for new accessibility behavior and re-enable the expansion panel in Playwright accessibility scans.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| projects/cps-ui-kit/src/lib/components/cps-expansion-panel/cps-expansion-panel.component.ts | Adds unique content IDs, keyboard interaction state, and runtime conversions for style inputs. |
| projects/cps-ui-kit/src/lib/components/cps-expansion-panel/cps-expansion-panel.component.html | Adds ARIA semantics and keyboard event wiring; switches to converted style inputs. |
| projects/cps-ui-kit/src/lib/components/cps-expansion-panel/cps-expansion-panel.component.scss | Adds focus-visible styling via shared focus-ring mixin; converts sizing from px to rem. |
| projects/cps-ui-kit/src/lib/components/cps-expansion-panel/cps-expansion-panel.component.spec.ts | Updates defaults and adds tests for ARIA attributes, keyboard interaction, and unique IDs. |
| projects/composition/src/app/pages/expansion-panel-page/expansion-panel-page.component.ts | Imports CpsButtonComponent for the updated example content. |
| projects/composition/src/app/pages/expansion-panel-page/expansion-panel-page.component.html | Updates examples (adds a button; switches some values to rem-based inputs). |
| projects/composition/src/app/pages/expansion-panel-page/expansion-panel-page.component.scss | Converts example layout spacing from px to rem. |
| projects/composition/src/app/api-data/cps-expansion-panel.json | Updates API docs description for borderRadius. |
| playwright/cps-accessibility.spec.ts | Re-enables expansion panel route in axe scanning list with a page-scoped selector. |
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 expansion panel component
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
[N/A] Error Handling
[N/A] Dynamic Content / Updates
Interaction Feedback / States
[N/A] Authentication & Sensitive Actions
Predictable & Controllable UI
Release notes: