Skip to content

feat: add table row group headers#4807

Draft
ernst-dev wants to merge 1 commit into
mainfrom
feat/table-row-group-headers
Draft

feat: add table row group headers#4807
ernst-dev wants to merge 1 commit into
mainfrom
feat/table-row-group-headers

Conversation

@ernst-dev

Copy link
Copy Markdown
Member

Description

Adds an opt-in rowGrouping property to Table that visually groups rows under non-selectable group header rows, without changing the flat items data structure.

rowGrouping accepts:

  • getGroupId(item) — returns a group id for each item. Consecutive items sharing an id form a group.
  • renderGroupHeader({ groupId, items }) — renders the content of the group header row.

A group header row is rendered above the first item of each group. It spans all visible columns (including the selection column) via a single colSpan cell and is not selectable, editable, or expandable. Tables that do not set rowGrouping are entirely unaffected (backward compatible).

Implementation follows the existing Table row-rendering pattern in internal.tsx (grouping is precomputed with useMemo; a new GroupHeaderRow sub-component renders the spanning row, avoiding per-column hooks). A new findRowGroupHeaders() test-utils selector is added, and findRows() now excludes group header rows.

Related links, issue #, if available: SIM AWSUI-60452

⚠️ Ticket mismatch note: SIM AWSUI-60452 (V1690323767) actually tracks an unrelated, already-closed a11y issue ("Aria-label required by accessibility is not able to be set on the AppLayout Toolbar"). This PR was implemented per the provided task description (Table row group headers), not the SIM contents.

How has this been tested?

  • New unit tests in src/table/__tests__/row-grouping.test.tsx (9 tests): group header rendering/ordering, colspan with & without selection, non-selectability, data-group-id, non-consecutive group ids, and findRows exclusion.
  • Full existing Table unit suite passes (546 tests, 43 suites).
  • Documenter and test-utils selector snapshots updated for the new prop/type/wrapper method.
  • ESLint, Stylelint, quick-build, and full build all green (Node v24).
  • New dev page pages/table/row-grouping.page.tsx for manual/visual verification (with and without selection).
Review checklist

The following items are to be evaluated by the author(s) and the reviewer(s).

Correctness

  • Changes include appropriate documentation updates.
  • Changes are backward-compatible if not indicated, see CONTRIBUTING.md.
  • Changes do not include unsupported browser features, see CONTRIBUTING.md.
  • Changes were manually tested for accessibility, see accessibility guidelines.

Security

Testing

  • Changes are covered with new/existing unit tests?
  • Changes are covered with new/existing integration tests?

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@codecov

codecov Bot commented Jul 23, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.61%. Comparing base (f97729a) to head (b5bdb2d).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4807   +/-   ##
=======================================
  Coverage   97.61%   97.61%           
=======================================
  Files         952      953    +1     
  Lines       30816    30852   +36     
  Branches    11318    11331   +13     
=======================================
+ Hits        30081    30117   +36     
- Misses        688      728   +40     
+ Partials       47        7   -40     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

1 participant