Skip to content

fix(Table): keep the grouped-rows chevron pinned under a custom header - #6222

Merged
ernestt merged 3 commits into
mainfrom
core-grouped-rows-sticky-chevron
Oct 7, 2026
Merged

ernestt merged 3 commits into
mainfrom
core-grouped-rows-sticky-chevron

Conversation

@ernestt

@ernestt ernestt commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

useTableGroupedRows loses its collapse chevron off the left edge as soon as a table is scrolled sideways — but only for callers who pass renderGroupHeader.

What was wrong

The group header's inner wrapper is position: sticky so the chevron and label ride along as the table scrolls horizontally. That only works if the wrapper is narrower than the cell it sits in: a sticky box is confined to its containing block, so one that already spans the cell — and the group header cell spans every column — has no slack to take up and never moves.

The shrink-wrap that provides that slack was gated behind !renderGroupHeader, on the reasoning that a custom heading might want the full column width. The cost of that choice wasn't visible at the time: it silently disabled the pinning it was paired with.

Both shots scroll the same table to its right edge. The group labels are drawn by a custom renderGroupHeader, which pins itself, so the label survives either way — it's the chevron that goes missing.

before — chevron gone after — chevron pinned
before after

Look at "Overview" and "Pricing": before, the labels are there and the toggles are not. The chevron in the after shot is also bigger than the one that went missing — that is the second commit, below.

Why userland can't work around it

The chevron belongs to the plugin. A caller can pin whatever they render inside renderGroupHeader, but they have no handle on the control, so there is no way to keep the toggle on screen from outside. That's what makes this a fix rather than a default worth debating: the gate protected a width choice for custom content while taking away the only interactive element in the row.

The affected combination is renderGroupHeader + useTableStickyColumns, which is what any wide comparison or spend table reaches for.

The change

width: fit-content moves onto headerInner unconditionally and headerInnerFitContent goes away. Net −4 lines plus comments.

A custom header that genuinely wants the full column width still lays out normally inside the shrink-wrapped span for any content that fills the visible cell; what it no longer gets is a wrapper wider than the viewport, which was never useful — that width existed off-screen.

Also: the chevron was 12px

Second commit. The chevron is the control for the whole section and it sits beside a heading, so at xsm it read as decoration on the label rather than the thing you press, and it was the smallest hit target in the table. sm — 16px — is what Collapsible uses for the same job.

before — 12px after — 16px

Row height is unchanged: the heading's line box is taller than either size, so the row was never measuring the chevron.

Tests

One regression test, asserting the wrapper carries the same class with and without renderGroupHeader. Verified it fails against main (expected 'useTableGroupedRows__styles.headerInn…' to be …) and passes here.

packages/core/src/Table is green: 552 tests, 27 files.

`useTableGroupedRows` shrink-wrapped its group-header wrapper only when
the header used the built-in heading. The reasoning was that a custom
`renderGroupHeader` may want the full column width — but a sticky box is
confined to its containing block, so a wrapper already spanning the cell
(and the cell spans every column) has no slack to take up and never
moves.

Any table combining `renderGroupHeader` with `useTableStickyColumns`
therefore lost its collapse toggle off-screen as soon as it scrolled
sideways, and userland could not fix it: the chevron belongs to the
plugin, so a caller can pin their own heading but cannot reach the
control.

The wrapper is now shrink-wrapped unconditionally.

Co-authored-by: Cursor <[email protected]>
@vercel

vercel Bot commented Sep 10, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
astryx Ready Ready Preview Sep 21, 2026 5:59am UTC

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Sep 10, 2026
@github-actions github-actions Bot added the needs:code-review High-risk change (new package/component/API) — needs human code review before merge label Sep 10, 2026
@astracat-bot

astracat-bot Bot commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟡 Reviewed (for maintainers only) Sep 24, 2026, 4:05 AM UTC

github-actions Bot added a commit that referenced this pull request Sep 10, 2026
@github-actions

github-actions Bot commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

📚 Storybook Preview

View Storybook for this PR
GitHub Pages may take up to a minute to hydrate after deploy.

🧪 Sandbox Preview

View Sandbox for this PR
GitHub Pages may take up to a minute to hydrate after deploy.

No new or modified components detected.

Bundle Size Summary

Package Size (ESM) Size (CJS) Gzipped
@astryxdesign/core N/A 4.8KB 1.2KB

Accessibility Audit

Status: 36 accessibility violation(s) found — 2 critical, 34 serious.

Button pattern - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 1/18 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
ChatComposer - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 1/18 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
ChatComposerInput - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 1/14 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
ChatReasoning - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 4/5 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
ChatToolCalls - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 10/11 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
Checkbox pattern - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 2/33 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
CheckboxList - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 4/17 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
ClickableCard - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 1/5 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
CodeEditor - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 3/7 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
CodeEditorPerf - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 2/2 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
CodeEditorTheme - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 13/14 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
CodeTheme - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 14/16 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
DateRangeInput - 1 issue(s)
  • 🔴 critical: Ensure an element's role supports its ARIA attributes
    • Rule: aria-allowed-attr · Affects 1/21 stories · Learn more
    • WCAG: 4.1.2 (Level A)
FileInput - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 3/15 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
GridMasonry - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 1/3 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
Heading - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 1/16 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
Icon - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 1/18 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
LogStream - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 2/3 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
MediaTheme Auto - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 1/5 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
PowerSearch - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 2/26 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
ProgressBar - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 2/18 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
Radio group pattern - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 3/26 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
RadioList - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 3/14 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
RichTextEditor - 2 issue(s)
  • 🟠 serious: Ensure every ARIA input field has an accessible name
    • Rule: aria-input-field-name · Affects 2/18 stories · Learn more
    • WCAG: 4.1.2 (Level A)
  • 🔴 critical: Ensure every form element has a label
    • Rule: label · Affects 1/18 stories · Learn more
    • WCAG: 4.1.2 (Level A)
SelectableCard - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 1/4 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
Stepper - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 1/30 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
TableGroupedRows - 1 issue(s)
  • 🟠 serious: Ensure ARIA attributes are used as described in the specification of the element's role
    • Rule: aria-conditional-attr · Affects 3/3 stories · Learn more
    • WCAG: 4.1.2 (Level A)
TableTree - 1 issue(s)
  • 🟠 serious: Ensure ARIA attributes are used as described in the specification of the element's role
    • Rule: aria-conditional-attr · Affects 8/9 stories · Learn more
    • WCAG: 4.1.2 (Level A)
Text - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 1/23 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
Theme - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 1/5 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
PopArt - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 3/6 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
Thumbnail - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 1/12 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
Timestamp - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 1/20 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
Token - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 2/10 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
Tokenizer - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 2/24 stories · Learn more
    • WCAG: 1.4.3 (Level AA)

Visual Regression

Status: No visual change across 2 compared shot(s).


Generated by PR Enrichment workflow | Storybook | Sandbox | View full report

The chevron is the control for an entire section and sits beside a heading,
so at 12px it read as decoration on the label rather than as the thing you
press, and it was the smallest hit target in the table. Row height is
unchanged — the heading's line box is taller than either size, so the row
was never measuring the chevron — and the button shrink-wraps the glyph, so
nothing needed resizing around it.

Co-authored-by: Cursor <[email protected]>
@ernestt

ernestt commented Sep 10, 2026

Copy link
Copy Markdown
Contributor Author

Added a second commit: the group-header chevron grows from 12px to 16px.

It is the control for an entire section and sits beside a semibold heading, so at 12 it read as decoration on the label rather than as the thing you press — and it was the smallest hit target in the table. The button shrink-wraps the glyph, so nothing needed resizing around it, and row height is unchanged at 41px because the heading's line box is taller than either chevron size. Measured both ways in the Core/TableGroupedRows stories rather than assumed.

It rides along here because it is the same element this PR is already about.

@ernestt

ernestt commented Sep 10, 2026

Copy link
Copy Markdown
Contributor Author

Follow-up opened as #6234: the same instinct on the vertical axis, hasStickyGroupHeaders, so the heading stays visible while scrolling down as well as sideways.

It is stacked on #6221 rather than folded in here, because it needs the header height that plugin now publishes, and because this PR is a regression fix that should stay revertable on its own.

@astracat-bot astracat-bot Bot 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.

Thanks, this does keep the existing collapse control reachable after horizontal scrolling in both LTR and RTL. Two unrelated visual changes still need to come out: the custom renderer’s containing block shrinks from the full row (1128px in the browser check) to its content (281px), so trailing full-row content moves beside the label; and the icon grows from 12px to 16px. Please preserve the existing custom-header layout and icon size while pinning only the plugin-owned control.

@cixzhang cixzhang 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.

Updating the icon seems okay. We should make sure we're not only testing this situation with the layout update and we cover its original intention

@ernestt

ernestt commented Sep 21, 2026

Copy link
Copy Markdown
Contributor Author

Added the broader icon intent in #6429. It records the default 16px control/disclosure role plus the full size, outlined/filled, color, composition, and accessibility guidance, rather than making this one Table test the source of truth. #6222 keeps focused regression coverage for the original full-width custom-header layout and the plugin-owned pinned control.

@humbertovirtudes humbertovirtudes 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.

The structural fix and accepted 16px icon direction look sound, but approval still needs exact-final-head browser evidence. Please demonstrate that the toggle remains visible and keyboard-operable at horizontal scroll end while a width: 100% custom header stays full width, in both LTR and RTL. The focused unit coverage cannot verify sticky overflow geometry.

astracat-bot[bot]
astracat-bot Bot previously requested changes Sep 24, 2026

@astracat-bot astracat-bot Bot 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.

Thanks for splitting the fix so the plugin-owned chevron is pinned while custom group headers keep their full-row width — the source and the new regression test now preserve both intended declarations, and the focused and full Table suites pass.

One check is still needed before approval: because position: sticky depends on real overflow geometry, please add or record a browser-level check on the final revision showing, in both LTR and RTL, that the chevron remains visible and keyboard-operable at horizontal scroll end while a width: 100% custom header still spans its cell. The current screenshots predate the final positioning split, and the unit test only inspects style declarations.

[Automated review]

@ernestt

ernestt commented Sep 25, 2026

Copy link
Copy Markdown
Contributor Author

Recorded the requested browser-level evidence against exact head 0fe70eda647c88e8fd7b52b1fd6be13721dc0010 using the PR Storybook Core/TableGroupedRows — Custom Order And Header in Chromium 151 at a 320×420 viewport, with the table forced to 900px inside its 288px horizontal scroll region.

  • LTR, horizontal end (scrollLeft = 612): the 16px toggle remained fully visible at x=20–36 inside the x=16–304 scrollport. The custom-header container remained 888px wide within the 900px cell (full width minus its 12px padding). Keyboard focus stayed on the toggle and Enter changed aria-expanded true → false → true.
  • RTL, horizontal end (scrollLeft = -612): the 16px toggle remained fully visible at x=284–300 inside the same x=16–304 scrollport. The custom-header container again remained 888px wide within the 900px cell. Keyboard focus stayed on the toggle and Enter changed aria-expanded true → false → true.

This covers the final split: only the plugin-owned control sticks, while the width: 100% custom-header container keeps its full-row geometry in both directions.

@github-actions github-actions Bot removed the needs:code-review High-risk change (new package/component/API) — needs human code review before merge label Oct 7, 2026
@ernestt
ernestt dismissed stale reviews from astracat-bot[bot] and humbertovirtudes October 7, 2026 23:44

Abandoning

@ernestt
ernestt merged commit 183b764 into main Oct 7, 2026
50 of 51 checks passed
@github-actions
github-actions Bot deleted the core-grouped-rows-sticky-chevron branch October 8, 2026 06:25

This branch was successfully deployed

1 active deployment
Preview — 0fe70eda Deployed Sep 21, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants