Skip to content

feat: fix a11y issues in expansion panel component#654

Open
fateeand wants to merge 3 commits into
masterfrom
586-fix-a11y-issues-in-expansion-panel-component
Open

feat: fix a11y issues in expansion panel component#654
fateeand wants to merge 3 commits into
masterfrom
586-fix-a11y-issues-in-expansion-panel-component

Conversation

@fateeand

@fateeand fateeand commented Jun 4, 2026

Copy link
Copy Markdown
Collaborator

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:

Component aria-roles color-contrast tabindex target-size
Expansion panel - - -

State after:

Component aria-roles color-contrast tabindex target-size
Expansion panel

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

    • Semantic HTML is used correctly.
    • ARIA roles, states, and properties are applied only when needed.
    • All form fields, tables, and widgets (including autocomplete, tree selects, tree tables, drag-and-drop, sliders, and multi-selects) are properly labeled and accessible.
  • Color / Contrast

    • Text and interactive elements meet contrast requirements (≥4.5:1 normal text, ≥3:1 large text).
    • Focus and selection indicators are visually perceivable.
    • Color is not the only indicator of state.
  • Screen Reader / Assistive Technology

    • All content, labels, and dynamic updates are perceivable via screen readers.
    • Live regions announce status messages, alerts, modals, notifications, and dynamic changes.
    • Interactive widgets provide proper announcements of selection and updates.
  • Responsive & Zoom

    • Components function correctly and remain readable at all viewport sizes and up to 200% zoom, including mobile and touch devices.
    • Prefer em/rem units over px where scaling is required.
  • [N/A] Error Handling

    • Errors are clearly identified visually and programmatically.
    • Form inputs use aria-describedby or aria-invalid for inline messages.
    • Instructions and suggestions are accessible.
  • [N/A] Dynamic Content / Updates

    • Status updates, alerts, notifications, and modals use live regions.
    • Updates do not disrupt focus or user control unexpectedly.
  • Interaction Feedback / States

    • All interactive states (hover, focus, active, disabled, drag-and-drop, reordering, multi-select) are visually perceivable.
  • [N/A] Authentication & Sensitive Actions

    • Inputs and actions involving sensitive data provide accessible instructions, feedback, and error messages.
  • Predictable & Controllable UI

    • Components behave consistently and predictably.
    • Popups, modals, autocomplete suggestions, drag-and-drop, and dynamic content allow user control.

Release notes:

  • Fix a11y issues in expansion panel component

@fateeand fateeand linked an issue Jun 4, 2026 that may be closed by this pull request
@github-actions

github-actions Bot commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

Coverage report for library

St.
Category Percentage Covered / Total
🔴 Statements 45.8% 3318/7244
🔴 Branches 41.15% 1450/3524
🔴 Functions 45.14% 632/1400
🔴 Lines 46.32% 3095/6682

Test suite run success

1125 tests passing in 33 suites.

Report generated by 🧪jest coverage report action from d723743

@github-actions

github-actions Bot commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

Playwright test results

passed  86 passed

Details

stats  86 tests across 4 suites
duration  2 minutes, 55 seconds
commit  d723743
info  For details, download the Playwright report

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
export class CpsExpansionPanelComponent
implements OnInit, AfterViewInit, OnChanges

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks, addressed

this.cvtWidth = convertSize(this.width);
}

this._logHeaderTitleError();

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe this can be also guarded under if (changes.headerTitle)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

addressed

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 px values to rem.
  • 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix a11y issues in expansion panel component

3 participants