Skip to content

feat(Table): make row expansion behave like its sibling plugins - #5995

Merged
ernestt merged 2 commits into
mainfrom
core-row-expansion-chevron-indent
Oct 7, 2026
Merged

ernestt merged 2 commits into
mainfrom
core-row-expansion-chevron-indent

Conversation

@ernestt

@ernestt ernestt commented Sep 3, 2026 •

Copy link
Copy Markdown
Contributor

What

Six changes to useTableRowExpansion. Four are repairs, two add options that close gaps against the plugin's siblings.

fix the chevron turned the button, not the arrow
fix the row divider split a row from its own panel
fix zebra striping counted the panel as a row
fix the detail panel started at the row edge
feat panelVariant — opt the panel's wash out, and flip the default
feat hasRowClickExpansion — the whole row toggles, as in useTableTreeData

Plus a refactor: both expansion plugins now share the clickable-container guards instead of each carrying its own selector list.

Three things want a decision before this lands — they are collected in Open questions at the bottom rather than buried in the sections.


fix — the chevron turned the button, not the arrow

transform: rotate(90deg) was on the <button>, which is the hit target and carries the ghost hover chip, so expanding a row swung that rounded rectangle and its highlight through a quarter turn along with the glyph. A finished 90° turn on a 24px rounded square lands back on itself, so this only shows up in motion, where the chip passes through a diamond. The transform now sits on the glyph; the button stays put.

Frames are mid-animation, transition stretched from 150ms to 3s so the middle is photographable.

Before — the chip is a diamond, dragged round by the arrow:

chevron before

After — the chip is square and still; only the arrow moves:

chevron after

The two chevron transitions move onto --duration-fast and --ease-standard in the same pass, matching what TableRow already uses for its own hover transition. Slightly slower at 175ms, and consistent.

fix — the divider split a row from its own detail

A row and its panel are one unit, but the line was landing between them. The row drew its own bottom border, putting a divider between the row and the detail it had just opened; the panel drew none, so it ran flush into the next row. The pair was cut down the middle and fused to the row below — the reverse of the grouping it should express.

The expanded row now gives up its border and the panel takes one.

Before — the line sits under Operating, and its detail runs straight into Payroll:

divider before

After — the row and its detail read as one block, and the line closes underneath:

divider after

Only the panel consults the divider mode, and only to know whether to draw at all. On a table with no row dividers the suppression removes a border that was never there, and the panel's is never applied. The panel row carries tableRowMarker — the same marker TableCell scopes its "no trailing line under the last row" rule to — so an expanded last row still ends the table cleanly.

fix — striping counted the panel as a row

cixzhang's question about how these behaviours combine turned up a real defect, and it predates everything else here.

Striping is CSS, :nth-child(even) on the <tr>. The detail panel is appended as a sibling <tr> in the same <tbody> (BaseTable's afterRow). So the panel took a stripe turn of its own and pushed every row below it onto the opposite one: expanding a single row repainted half the table. On top of that, the panel's muted wash painted the same token the stripe uses, so on a striped table the panel was indistinguishable from a data row.

The stripe now counts :nth-child(even of :not([data-expansion-panel])). A panel is not a row and is not counted as one, so the data rows keep their parity whatever is open.

of S has been Baseline since 2023, inside the AST-013 support floor; below it the rule drops rather than misapplies — an unstriped table, not a mis-striped one. Verified StyleX emits it intact.

Tables without the row-expansion plugin are unaffected: nothing else in the system emits data-expansion-panel.

fix — the panel started at the row edge

The panel is one cell spanning the whole row with a flat 20px inline padding, so its content began under the chevron — a column to the left of every label it describes. It now indents to the first real column:

panel alignment

The start padding is the chevron column's fixed width plus the inline padding a cell of that density gives its own content — calc(--spacing-10 + var(--spacing-3)) at balanced. Density comes off the table context, which is why the panel had to become a small component (ExpansionPanelCell) rather than a bare <td>: the plugin builds this row inside transformBodyRow, outside the Table's own render, so the context is not otherwise in hand. That component carries the row divider too.

It is a logical property, so RTL mirrors it, and it is not configurable — a panel starting anywhere else reads as a misalignment rather than as a choice.

EXPANSION_COLUMN_WIDTH_PX = 40 stays a number, because a column width is arithmetic the layout does rather than a CSS value. But 40px is --spacing-10, and the indent spells it as the token, so a test pins the rendered column width to spacingDefaults['--spacing-10'] — the two silently drifting apart would unalign the panel.

feat — panelVariant

The panel's muted wash was hardcoded, and being a <tr> the plugin builds itself, nothing a caller rendered could reach it.

The default flips to transparent. The panel is the row's continuation, not a surface of its own, so it takes whatever the table sits on — the same thing the row does. A table on a Card no longer stacks a third surface, and a striped table no longer paints a band in the same token as its own stripe. 'muted' stays available for the bare table — no card, no dividers, no striping — where nothing else separates the panel from the data.

'muted' 'transparent' (new default)
muted transparent

This changes the default appearance — called out in the changeset. A table relying on the wash gets it back with panelVariant: 'muted'. In dark themes there is nothing to get back: --color-background-muted and --color-background-card resolve to the same value there, so dark has effectively been rendering transparent all along. The prop is really a light-mode affordance; in dark it mostly decides what happens when the theme later separates those two tokens.

feat — hasRowClickExpansion

useTableTreeData already lets the row body toggle its own disclosure; this plugin only accepted the chevron, so two tables with the same affordance behaved differently depending on which plugin drew it. Same prop name, same default of false, so nothing changes for existing callers.

useTableRowExpansion({
  renderExpanded: item => <AccountDetail account={item} />,
  hasRowClickExpansion: true,
});

Off by default and pointer-only; the chevron button stays the accessible control, so keyboard and assistive-tech users are unaffected. The handler steps aside for anything with its own answer to a click, and for a live text selection, so dragging across a cell to copy a figure does not also collapse what you were reading. Collapsed rows are wired up too, which is most of the point — the row worth clicking is the one that has not opened yet. Rows the predicate rules out stay inert and keep the default cursor.

row hover

row opened

refactor — share the clickable-container guards

Both expansion plugins carried their own copy of the nine-selector "did this click belong to something else" check. useClickableContainer already owns that rule for every clickable surface in the system, with a fuller list — role="link", radio, switch, tab, menuitem, option, combobox, listbox, slider, spinbutton, [data-pressable-container] — and an [aria-readonly="true"] exclusion.

The hook itself wants a ref to the container, and a <tr> assembled inside transformBodyRow has none to hand it, so this exports the two guards it is built from — hasInteractiveAncestor and hasTextSelection — and calls those from both plugins. One definition, three callers.

This adds public surface without looking like it. Two new exports on the hooks barrel are a public promise, and an export ossifies the same way a prop does. Worth saying plainly rather than filing as a dedupe.

Two behaviour fixes fall out of sharing:

  • A click on a composed control the short list missed — a role="tab", a segmented role="radio", a Slider in a cell — no longer toggles the row underneath it.
  • The selection guard is scoped to the row instead of asking the document for any selection. Text selected in a sidebar no longer makes every row inert.

Open questions

1. The panel indent assumes the chevron is the leading column. humbertovirtudes' fifth probe. The indent is calc(--spacing-10 + <density padding>) — the chevron column's width plus a cell's own inline padding — which is correct only while the chevron is first. Add a selection checkbox or a row-index column and the panel lands a column short.

The plugin already makes exactly this assumption for the panel's colSpan (columnCountRef is captured in transformColumns, so a plugin that prepended a column later would throw both off), so this is the same latent limit in a second place rather than a new one. It is still wrong, and it is wrong in the combination people actually build: selection plus expansion is the common pairing.

The fix wants the leading-column offset derived from the resolved column set rather than assumed, which means the plugin needs to know what ran before it. That is a shape question about the plugin protocol, not a patch — flagging rather than guessing.

2. hasRowClickExpansion and the selection plugin. cixzhang asked this to match the selection plugin's row-click option. useTableSelection has no row-click option today; the one precedent is useTableTreeData.hasRowClickExpansion, which this copies exactly — same name, same false default, same guards.

The open question is the one underneath: a table with both plugins and both flags on has one click and two meanings. Which wins, or is the combination refused? Worth deciding before this surface lands, because the answer may change the shape.

3. No plugin has a .spec.md. The combinations that need writing down for this one are rowExpansion × striping, × selection, × groupedRows, × stickyColumns, × dividers. Happy to do a design-only plugin spec record first and rebase this onto it, same shape as the #6194 → #6232 split.

Also worth a reviewer's eye

The indent lands 1px short, and that 1px is not mine. Measured in the browser: panel content at x=184, first column's text at x=185. The formula is exact; the gap is the UA stylesheet's td { padding: 1px } leaking into cells that own a context menu. TableCell relocates density padding onto the right-click trigger for those cells and leaves the <td> with font/box-sizing only — no padding — which is true of the authored rules but not of the computed result. This plugin puts a context menu on every cell, so every one carries the stray pixel. The fix is a one-line padding: 0 in TableCell, but it shifts every context-menu cell in the system by 1px in both axes, so it wants its own PR and its own visual pass rather than riding along here.

Test plan

  • vitest run packages/core/src/Table packages/core/src/hooks — 945 passed across 54 files; the Table suite alone is 568 across 26, up from 540.
  • tsc --noEmit and eslint clean; full pre-commit check suite green.
  • 22 new cases in useTableRowExpansion.test.tsx:
    • chevron and panel placement (4) — the glyph carries the rotation and the button does not; the panel's start padding is calc(--spacing-10 + var(--spacing-3)) at the default density; it follows density to --spacing-4 at spacious; the chevron column's width is pinned to spacingDefaults['--spacing-10'].
    • row divider placement (4) — closes below the panel; collapsed rows keep their own; nothing drawn on a table without row dividers; drawn under grid dividers too.
    • zebra striping (2) — every stripe rule carries the panel exclusion; the panel row is marked so the rule can skip it.
    • panel variant (2) — on the surface behind the table by default, washed when muted is asked for.
    • whole-row-click expansion (8) — inert by default; expands; collapses; no double-toggle from the chevron; yields to interactive cell content; yields to a text selection in the row; toggles despite a selection elsewhere on the page; leaves non-expandable rows inert; cursor: pointer only when wired up.
  • jsdom's selector engine does not implement :nth-child(… of S) — it silently matches nothing — so the stripe paint itself is browser-side coverage via visual regression, and the unit test asserts the emitted rule instead. That is commented at the test.
  • Measured before/after in the grouped-accounts template: panel start padding 20px → 48px, content x=156 → x=184 against a first column at x=185.

Seven changesets included, one per change.

Still outstanding from review

humbertovirtudes' probes 1–4 — contenteditable clicks, preventDefault() from a prior handler, grouped-row empty-key panels, tree and detail both firing — are not addressed in this push. They are all hasRowClickExpansion composition, and they want open question 2 settled first, since the answer to "which plugin owns the click" decides several of them.

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Sep 3, 2026
@vercel

vercel Bot commented Sep 3, 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 23, 2026 8:59pm UTC

Request Review

@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 3, 2026
@ernestt

ernestt commented Sep 3, 2026

Copy link
Copy Markdown
Contributor Author

The red test and visual-acceptance checks here are not from this PR — main is currently broken.

packages/cli/api/search/search.mjs:277 returns without the matched/total its JSDoc declares, which is a TS2739 under checkJs. That fails the "Verify the published CLI ./api type surface" step, which runs before Run pnpm test (so test fails with zero tests executed) and also fails build-storybook, which skips the visual-evidence job and leaves visual-acceptance with nothing to publish.

Fix is up as #5996 (one line). Once that lands I'll rebase this and the checks should clear.

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

github-actions Bot commented Sep 3, 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.9KB 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/19 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/16 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: Skipped — Broad stable scope is deferred to the daily release gate. It covers 390 trusted baseline shots instead of recapturing them for this PR. View the report


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

@ernestt

ernestt commented Sep 3, 2026

Copy link
Copy Markdown
Contributor Author

Correction to the note above: I've closed #5996 rather than landing it, since the break is not mine to fix. The diagnosis is preserved on that PR for whoever owns it.

Nothing here changes — the red test and visual-acceptance on this PR are still caused by main, not by this change, and they'll clear on a rebase once main is fixed.

github-actions Bot added a commit that referenced this pull request Sep 4, 2026
@ernestt ernestt changed the title fix(Table): turn only the row-expansion chevron glyph, indent its panel to the first column feat(Table): make row expansion behave like its sibling plugins Sep 4, 2026
@ernestt

ernestt commented Sep 4, 2026

Copy link
Copy Markdown
Contributor Author

Added: hasRowClickExpansion

Pushed a third change, which is why the title now reads more broadly. useTableRowExpansion gains hasRowClickExpansion — click anywhere on a row to toggle its panel.

Why it belongs in core rather than in the caller. useTableTreeData has carried this flag since it shipped, under the same name, with the same guards. The two plugins are halves of one pair — one expands into child rows, one into a panel — and a caller moving between them lost whole-row clicking with nothing to say why. It also cannot be added from outside: a row-level click handler has to know not to fire on a checkbox, a link, or the end of a text drag, and none of that is reachable through the plugin API. The alternative was every caller reimplementing the same three guards, which is what the template that prompted this was about to do.

Shape. Off by default. Pointer-only when on — the chevron button stays the accessible control, so this is a mouse shortcut, not a second way to operate the table. Clicks landing on interactive cell content, clicks ending a text selection, and rows getIsItemExpandable has ruled out all pass through. The chevron already stops propagation, so it does not toggle twice.

The one non-obvious bit: the handler is attached before the collapsed early-return, not after. transformBodyRow used to bail as soon as it saw a row was not expanded, since there was no panel to build — but a collapsed row is exactly the one a click needs to reach.

Tests. Seven new cases, mirroring the tree plugin's coverage: inert by default; expands a collapsed row; collapses an expanded one; no double-toggle via the chevron; yields to a button in a cell; yields to a text selection; leaves non-expandable rows alone; and cursor: pointer appears only when the flag is on. vitest run packages/core/src/Table/plugins/rowExpansion — 24 passed.

Separate [feat] changeset, so the fix and the feature stay legible in the release notes.

@ernestt

ernestt commented Sep 4, 2026

Copy link
Copy Markdown
Contributor Author

Added: panelVariant

Fourth change. The panel row painted --color-background-muted unconditionally, and since the plugin builds that <tr> itself, nothing a caller renders can reach the background. panelVariant: 'muted' | 'transparent' — matching Card's vocabulary, default unchanged.

Why not just change the default. The wash is genuinely load-bearing in a bare table: no card, no dividers, and it is the only thing telling a detail panel apart from another row of data. It is wrong specifically for a table already on a Card or Section, where it stacks a third surface on the second. That is a caller's context, not something the plugin can infer, so it is a prop.

One finding worth recording. --color-background-muted resolves to #0536590C in light and #1111127F in dark. Over the dark card at #1F1F22, that half-alpha near-black is close to a no-op — the muted and transparent frames are indistinguishable in dark mode. So the wash is effectively a light-theme feature, and dark themes have been rendering transparent all along. That is not a regression and I have not touched it, but it is why turning the wash off costs less than it looks like it should, and it may be worth a separate look at whether the dark token is doing what it intends.

Two new tests: the default washes the panel; transparent does not. vitest run packages/core/src/Table/plugins/rowExpansion — 26 passed.

Separate [feat] changeset. The PR now carries two fixes and two features; happy to split the features out into their own PR if that reads better for review — they are independent of the chevron and indent work, just in the same file.

@astracat-bot

astracat-bot Bot commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
❓ Needs maintainer input (for maintainers only) Oct 7, 2026, 11:09 PM UTC

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

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

Requesting changes based on an exact-head Table steward review. The new public options and default behavior are not admitted by current Table authority. Five focused composition probes also fail: contenteditable clicks toggle expansion, prior handlers cannot cancel with preventDefault(), grouped-row order can create an empty-key panel, tree and detail activation can both fire, and panel indentation ignores leading selection or row-index columns. Please establish the public contract, fix event and layout composition, and commit regression coverage for these paths before approval.

Three fixes to useTableRowExpansion, none of which adds public surface.

The chevron's rotation was on the <button>, which is the hit target and
carries the ghost hover chip, so expanding a row swung that rounded
rectangle and its highlight through a quarter turn along with the glyph.
A finished 90 degree turn on a 24px rounded square lands back on itself,
so it only shows in motion, where the chip passes through a diamond. The
transform now sits on the glyph; the button stays put. The two chevron
transitions move onto --duration-fast and --ease-standard while here,
matching what TableRow already uses for its own hover transition.

The row divider was landing between a row and its own detail panel: the
row drew its bottom border, putting a line between the row and the thing
it had just opened, and the panel drew none, so it ran flush into the
next row. The expanded row now gives up its border and the panel takes
one. On a table with no row dividers the suppression removes a border
that was never there and the panel's is never applied, so only the panel
consults the divider mode, to know whether to draw at all. The panel row
carries tableRowMarker, the marker TableCell scopes its "no trailing
line under the last row" rule to, so an expanded last row still ends the
table cleanly.

Zebra striping counted the panel as a row. The panel is a sibling <tr>
in the same <tbody>, so :nth-child(even) gave it a stripe turn of its
own and pushed every row below an open panel onto the opposite stripe —
expanding one row repainted half the table. Striping now counts
:nth-child(even of :not([data-expansion-panel])); the panel is its row's
continuation, not a row of its own, so the data rows keep their parity
whatever is open. `of S` has been Baseline since 2023, inside the
AST-013 support floor; below it the rule drops rather than misapplies.
@ernestt
ernestt force-pushed the core-row-expansion-chevron-indent branch from be17fbe to b4e26fe Compare September 23, 2026 19:02
@ernestt ernestt changed the title feat(Table): make row expansion behave like its sibling plugins fix(Table): repair three row-expansion defects Sep 23, 2026
@ernestt

ernestt commented Sep 23, 2026

Copy link
Copy Markdown
Contributor Author

Split: this PR is now the three uncontested fixes

Force-pushed. The previous head was be17fbe if anything needs recovering from it, and it stays in this PR's timeline.

What is here now — the subset that adds no public surface and changes no released API:

fix the chevron turned the button, not the arrow
fix the row divider split a row from its own panel
fix zebra striping counted the panel as a row

What moved to #6480, stacked on this branch:

why
panel indent to the first column the indent assumes the chevron is the leading column, so it lands wrong when a selection or row-index column precedes it — humbertovirtudes' fifth probe
panelVariant new prop, and it flips the released default from muted to transparent
hasRowClickExpansion new prop; the selection-plugin shape question is still open
shared clickable-container guards adds hasInteractiveAncestor and hasTextSelection to the hooks barrel — two new public exports, so surface even though it reads as a dedupe

Apologies for the stale threads. Four of the inline comments were anchored to lines that now live in #6480. Nothing in them is dismissed — every one is carried over into that PR's description, with the three that are genuinely open questions for an owner called out at the top rather than answered unilaterally. The striping thread is the exception: that one found a real defect and its fix is here, in this PR.

The reason for splitting rather than pushing another round: both open change requests point at the feature half, and none of them point at these three. Holding a visible chevron bug, a misplaced divider and a striping defect behind the hasRowClickExpansion composition questions did not seem right.

vitest run packages/core/src/Table — 554 passed across 26 files. tsc --noEmit and eslint clean.

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

Approve. The three fixes check out against current Table authority with no new public surface and no prop-default change: the chevron rotates the Icon-owned glyph instead of the button, the divider closes below the row-plus-panel pair with the last-row rule mirroring TableCell's own, and striping counts data rows only. Focused unit coverage pins each behavior, and the Table suite (554 tests), typecheck, and lint pass.

Two small nits, neither blocking:

  • The PR body says "8 new cases" but the diff adds 7 it()s (the body's own breakdown sums to 7).
  • Nothing pins the expanded-last-row border suppression — worth one focused test since the rule is load-bearing for a clean table end.

I also confirmed the two open change requests both predate the split and address the feature half now living in the stacked PR, so they don't block this one.

[Automated review]

github-actions Bot added a commit that referenced this pull request Sep 23, 2026
@ernestt
ernestt dismissed stale reviews from cixzhang and humbertovirtudes September 23, 2026 20:41

Split out fixes from contested features

Stacked on the row-expansion fixes. Everything here either adds public
surface or changes a released default, which is why it is separate from
those.

panelVariant: 'muted' | 'transparent' — the panel row painted
--color-background-muted unconditionally, and being a <tr> the plugin
builds itself, nothing a caller rendered could reach it. The default
becomes transparent: the panel is the row's continuation, not a surface
of its own, so it takes whatever the table sits on. muted stays for the
bare table — no card, no dividers, no striping — where nothing else
separates the panel from the data. This changes the default appearance.

hasRowClickExpansion — the whole row toggles its panel, matching the
flag useTableTreeData has carried since it shipped. Off by default and
pointer-only; the chevron stays the accessible control.

Sharing the click guards: both expansion plugins carried their own copy
of the nine-selector "did this click belong to something else" check.
useClickableContainer already owns that rule with a fuller list, so its
hasInteractiveAncestor and hasTextSelection are exported for containers
that cannot use the hook itself — a <tr> assembled in transformBodyRow
has no ref to hand it — and both plugins call them.

The panel indent: the detail panel spanned the row with a flat inline
padding, leaving its content under the chevron, a column to the left of
every label it describes. It now indents by the chevron column's width
plus the density's own cell padding, read off the table context.
@ernestt ernestt changed the title fix(Table): repair three row-expansion defects feat(Table): make row expansion behave like its sibling plugins Sep 23, 2026
astracat-bot[bot]
astracat-bot Bot previously requested changes Sep 23, 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.

Request changes. The three row-expansion repairs themselves check out: the chevron rotates the glyph instead of the button, the divider closes below the row-plus-panel pair, and striping counts data rows only. Focused tests pin each one, and the Table suite (568 tests), typecheck, and lint pass on this branch.

But this branch currently also carries the feature half that the PR body says lives in #6480 — panelVariant (which flips the default panel from muted to transparent), hasRowClickExpansion, the panel indent, and the shared click guards. That half needs to leave this branch; the prior approval covered only the fix-only state and doesn't transfer. Three source-verified issues ride with it and should move to #6480 together:

  • The shared-guard rewrite dropped the editable-content exclusion both plugins used to have, so clicks in editable regions now toggle rows (including through tree dispatch). The interaction test covers only <button>.
  • The panel indent doesn't account for selection or row-index leading columns, so it misaligns in that supported composition.
  • The row-click handler ignores preventDefault, so a prior handler can't cancel the toggle.

Two nits: the PR body still says "8 new cases" (7 per the prior fix-only review, 21 added on this branch), and nothing pins the expanded-last-row border suppression.

[Automated review]

@ernestt

ernestt commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor Author

Changeset compliance

One release entry needs correction before merge:

  • .changeset/table-row-expansion-panel-variant.md explicitly changes the released default from a muted panel to a transparent panel and gives the migration (panelVariant: 'muted'). Under AST-017, that is a breaking change to released usage, so the entry must use [breaking] with @astryxdesign/core: minor, not [feat] with patch.
  • A breaking entry also requires a registered codemod, focused coverage, and an explicit codemod mention in the changeset. Focused default-behavior coverage exists, but no codemod or codemod mention is present.

The other six entries match their package deltas and categories, and their #5995 references are current.

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

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

Requesting changes on the current head. Moving row clicks to the shared guard drops the previous contenteditable exclusion, so editing inside a row can toggle tree or detail expansion. Please restore [contenteditable]:not([contenteditable="false"]) and cover both paths. panelVariant, hasRowClickExpansion, and the transparent default also need a current owning contract, while the two guard helpers should stay out of the public barrel unless separately admitted.

@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 fixes and the new surface so cleanly in the description — the repair half of this is in good shape. The chevron now turns only its glyph, the divider closes below the row-plus-panel pair, striping counts data rows only, and the panel starts at the first column; focused tests pin each behavior, the Table suite passes, and before/after browser frames confirm the composed result.

Approval is waiting on a maintainer decision first. The current Table contract records no new public API and there is no governing record yet for the new surface this PR adds, so a maintainer needs to provide or identify the governing spec for three things: panelVariant including the default flip from muted to transparent, hasRowClickExpansion including which plugin owns the row click when selection also wants it, and the two new hooks-barrel exports. The PR already flags this gap and offers to write that record — that decision is what unblocks the feature half, not more test coverage.

Four fixes are also needed, and they stay required after that decision:

  • Clicks in editable cell content currently toggle rows in both expansion plugins (the shared guard lost the tree plugin's editable exclusion); please restore it and cover both paths.
  • A prior row-click handler cannot cancel the toggle with preventDefault; please honor it.
  • The panel indent counts only the chevron column, so it lands one column short whenever a selection or row-index column leads; please derive it from the resolved leading columns.
  • The default flip is labeled as a patch-level feature in its changeset; it should be marked breaking so the migration is visible to upgraders.

Two small nits: the description counts 22 new test cases where the file grows by 21, and the expanded-last-row border suppression could use one pinning test.

[Automated review]

@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:39

Abandoning

@ernestt
ernestt merged commit 1a16c82 into main Oct 7, 2026
50 of 51 checks passed

This branch was successfully deployed

1 active deployment
Preview — f201b9ff Deployed Sep 23, 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