Skip to content

feat: fix a11y issues in table component#680

Open
fateeand wants to merge 18 commits into
masterfrom
596-fix-a11y-issues-in-table-component
Open

feat: fix a11y issues in table component#680
fateeand wants to merge 18 commits into
masterfrom
596-fix-a11y-issues-in-table-component

Conversation

@fateeand

@fateeand fateeand commented Jun 25, 2026

Copy link
Copy Markdown
Collaborator

Fixing accessibility issues in table 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


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.
  • 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.

Additional changes

Bugs fixed:

  • Row expansion was not functioning because primeng changed the internal template name from rowexpansion to expandedrow in a version released between 19-21.
  • The column resize indicator was not displayed because primeng renamed the internal css class from p-column-resizer-helper to p-datatable-column-resize-indicator between versions 19-21.
  • In fit resize mode, resizing a column incorrectly affected the widths of unrelated columns when the table width exceeded the available viewport width.

Release notes:

  • Fix a11y issues in table component

Copilot AI review requested due to automatic review settings June 25, 2026 07:56
@fateeand fateeand linked an issue Jun 25, 2026 that may be closed by this pull request
@github-actions

github-actions Bot commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Coverage report for library

St.
Category Percentage Covered / Total
🔴 Statements 59.08% 4643/7859
🔴 Branches 51.92% 2040/3929
🔴 Functions 58.8% 879/1495
🔴 Lines 59.88% 4337/7243

Test suite run success

1818 tests passing in 51 suites.

Report generated by 🧪jest coverage report action from a514463

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 accessibility of the cps-table component and related internal table UI (sorting, filtering, pagination, row actions, and row reordering), and adds automated coverage to prevent regressions.

Changes:

  • Adds/updates accessible interactive affordances (proper buttons, ARIA labels/states, focus-visible styles, keyboard handlers) across table toolbar, header, row expansion, row actions, and column filter UI.
  • Introduces keyboard-based row reordering with live announcements and stronger paginator keyboard navigation/focus management.
  • Refactors table directives into dedicated subfolders and adds Jest unit tests + re-enables Playwright a11y coverage for the Table composition page states.

Reviewed changes

Copilot reviewed 41 out of 42 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
projects/cps-ui-kit/src/public-api.ts Updates exports to match the new directive/pipe folder structure.
projects/cps-ui-kit/src/lib/components/cps-table/pipes/cps-table-detect-filter-type/cps-table-detect-filter-type.pipe.ts Adjusts import path after pipe relocation.
projects/cps-ui-kit/src/lib/components/cps-table/pipes/cps-table-detect-filter-type/cps-table-detect-filter-type.pipe.spec.ts Adds unit tests for filter-type detection behavior.
projects/cps-ui-kit/src/lib/components/cps-table/directives/cps-table-row-selectable/cps-table-row-selectable.directive.ts Adds row-checkbox directive (new file).
projects/cps-ui-kit/src/lib/components/cps-table/directives/cps-table-row-selectable/cps-table-row-selectable.directive.spec.ts Adds unit tests for row-checkbox directive.
projects/cps-ui-kit/src/lib/components/cps-table/directives/cps-table-header-selectable/cps-table-header-selectable.directive.ts Sets header checkbox aria label for “select all”.
projects/cps-ui-kit/src/lib/components/cps-table/directives/cps-table-header-selectable/cps-table-header-selectable.directive.spec.ts Adds unit tests for header-checkbox directive.
projects/cps-ui-kit/src/lib/components/cps-table/directives/cps-table-column-sortable/cps-table-column-sortable.directive.ts Replaces old sortable directive implementation with an a11y-focused version (new location).
projects/cps-ui-kit/src/lib/components/cps-table/directives/cps-table-column-sortable/cps-table-column-sortable.directive.spec.ts Adds unit tests for sortable directive behavior/ARIA.
projects/cps-ui-kit/src/lib/components/cps-table/directives/cps-table-column-sortable.directive.ts Removes old sortable directive file.
projects/cps-ui-kit/src/lib/components/cps-table/directives/cps-table-column-resizable/cps-table-column-resizable.directive.ts Adds keyboard-resizable column support + ARIA separator semantics (new location).
projects/cps-ui-kit/src/lib/components/cps-table/directives/cps-table-column-resizable/cps-table-column-resizable.directive.spec.ts Adds unit tests for resizable directive (keyboard + patch behavior).
projects/cps-ui-kit/src/lib/components/cps-table/directives/cps-table-column-resizable.directive.ts Removes old resizable directive file.
projects/cps-ui-kit/src/lib/components/cps-table/directives/cps-table-column-filter/cps-table-column-filter.directive.ts Updates imports after directive relocation.
projects/cps-ui-kit/src/lib/components/cps-table/directives/cps-table-column-filter/cps-table-column-filter.directive.spec.ts Adds unit tests for column filter directive.
projects/cps-ui-kit/src/lib/components/cps-table/cps-table.component.ts Adds keyboard reorder state, paginator key handling, live announcer integration, and pass-through ARIA adjustments.
projects/cps-ui-kit/src/lib/components/cps-table/cps-table.component.spec.ts Adds comprehensive unit tests for new table behaviors.
projects/cps-ui-kit/src/lib/components/cps-table/cps-table.component.scss Improves focus-visible styling, rem-based sizing, and visual affordances for a11y.
projects/cps-ui-kit/src/lib/components/cps-table/cps-table.component.html Adds ARIA attributes, replaces icon-click affordances with buttons, adds keyboard reorder handle semantics, and new column toggle component.
projects/cps-ui-kit/src/lib/components/cps-table/components/internal/table-row-menu/table-row-menu.component.ts Tracks open state to drive aria-expanded.
projects/cps-ui-kit/src/lib/components/cps-table/components/internal/table-row-menu/table-row-menu.component.spec.ts Adds unit tests for row action menu accessibility state.
projects/cps-ui-kit/src/lib/components/cps-table/components/internal/table-row-menu/table-row-menu.component.scss Updates styles for button affordance + focus ring.
projects/cps-ui-kit/src/lib/components/cps-table/components/internal/table-row-menu/table-row-menu.component.html Converts row actions trigger to a <button> with aria attributes.
projects/cps-ui-kit/src/lib/components/cps-table/components/internal/table-column-visibility-toggle/table-column-visibility-toggle.component.ts Adds a keyboard-navigable listbox-based column visibility toggle (new component).
projects/cps-ui-kit/src/lib/components/cps-table/components/internal/table-column-visibility-toggle/table-column-visibility-toggle.component.spec.ts Adds unit tests for column visibility toggle keyboard and ARIA behavior.
projects/cps-ui-kit/src/lib/components/cps-table/components/internal/table-column-visibility-toggle/table-column-visibility-toggle.component.scss Styles for the listbox-like column toggle menu.
projects/cps-ui-kit/src/lib/components/cps-table/components/internal/table-column-visibility-toggle/table-column-visibility-toggle.component.html Renders toggle button + listbox options markup and ARIA.
projects/cps-ui-kit/src/lib/components/cps-table/components/internal/table-column-filter/table-column-filter.component.ts Tracks open state to drive aria-expanded and styling hooks.
projects/cps-ui-kit/src/lib/components/cps-table/components/internal/table-column-filter/table-column-filter.component.spec.ts Adds unit tests for filter menu open state and ARIA.
projects/cps-ui-kit/src/lib/components/cps-table/components/internal/table-column-filter/table-column-filter.component.scss Refines sizing and focus styling for filter trigger and controls.
projects/cps-ui-kit/src/lib/components/cps-table/components/internal/table-column-filter/table-column-filter.component.html Converts interactive icons to buttons; adds aria-expanded/labels and keyboard affordances.
projects/cps-ui-kit/src/lib/components/cps-table/components/internal/table-column-filter-constraint/table-column-filter-constraint.component.spec.ts Adds unit tests for constraint inputs by type.
projects/cps-ui-kit/src/lib/components/cps-table/components/internal/table-column-filter-constraint/table-column-filter-constraint.component.scss Switches sizing to rem.
projects/cps-ui-kit/src/lib/components/cps-table/components/internal/cps-sort-icon/cps-sort-icon.component.ts Makes sort icon keyboard-focusable with role/button semantics and aria-label updates.
projects/cps-ui-kit/src/lib/components/cps-table/components/internal/cps-sort-icon/cps-sort-icon.component.spec.ts Adds unit tests for keyboard sorting and aria-label changes.
projects/cps-ui-kit/src/lib/components/cps-table/components/internal/cps-sort-icon/cps-sort-icon.component.scss Adds focus-visible styling + spacing adjustments.
projects/cps-ui-kit/src/lib/components/cps-table/components/internal/cps-sort-icon/cps-sort-icon.component.html Marks purely visual sort indicators as aria-hidden.
projects/cps-ui-kit/src/lib/components/cps-paginator/cps-paginator.component.html Sets a consistent width for the “items per page” select.
projects/composition/src/app/pages/table-page/table-page.component.ts Adds missing alt text for an example image in HTML-rendering demo data.
projects/composition/src/app/pages/table-page/table-page.component.scss Converts padding to rem.
projects/composition/src/app/pages/table-page/table-page.component.html Converts scroll/height examples to rem units.
playwright/cps-accessibility.spec.ts Re-enables table route and adds per-tab state coverage for a11y tests.
Comments suppressed due to low confidence (1)

projects/cps-ui-kit/src/lib/components/cps-table/pipes/cps-table-detect-filter-type/cps-table-detect-filter-type.pipe.ts:7

  • In Angular v21+ standalone is the default, so standalone: true should be removed from the pipe metadata to avoid redundant configuration and align with the project guideline.

Comment thread projects/cps-ui-kit/src/lib/components/cps-table/cps-table.component.html Outdated
@github-actions

github-actions Bot commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Playwright test results

passed  106 passed

Details

stats  106 tests across 4 suites
duration  3 minutes, 57 seconds
commit  a514463
info  For details, download the Playwright report

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 table component

2 participants