An open source design system that's fully customizable and agent ready
TypeScript
fix(Table): a muted row-expansion panel slides in with its content (#10403)
Christopher Chedeau2497956e3e10
diff --git a/.changeset/table-muted-panel-slides.md b/.changeset/table-muted-panel-slides.mdnew file mode 100644index 0000000000..c907bf183f--- /dev/null+++ b/.changeset/table-muted-panel-slides.md@@ -0,0 +1,7 @@+---+'@astryxdesign/core': patch+---++[fix] Table: a row expansion panel with `panelVariant="muted"` now paints its wash on its cell, so with an `animatedLayout` handle the wash slides in with the panel's content. On iOS Safari the panel's edge trailed the rows gliding below it for a few frames; now they stay together. At rest the panel looks the same.++@vjeuxdiff --git a/apps/storybook/stories/TableRowExpansion.stories.tsx b/apps/storybook/stories/TableRowExpansion.stories.tsxindex 02c9e31fd9..9569d28488 100644--- a/apps/storybook/stories/TableRowExpansion.stories.tsx+++ b/apps/storybook/stories/TableRowExpansion.stories.tsx@@ -227,7 +227,8 @@ const sevenOrders = manyOrders.slice(0, 7);* fourth order's row itself (`tr`), which glides with the row too; `edgeBorder`* sets one on the tbody's bottom (`tbody`) or as the top of the fifth order's* cells (`top`), each of which wins the collapse and glides with its row;- * `wideBorder` sets a theme's 2 px green divider on every row.+ * `wideBorder` sets a theme's 2 px green divider on every row; `muted` sets+ * `panelVariant="muted"`, whose wash slides in with the panel's content.*/export const GlidingRows: StoryObj<{themed?: boolean;@@ -235,6 +236,7 @@ export const GlidingRows: StoryObj<{wideBorder?: boolean;edgeBorder?: 'none' | 'tbody' | 'top';dividers?: 'rows' | 'columns' | 'grid';+ muted?: boolean;}> = {args: {themed: false,@@ -242,8 +244,9 @@ export const GlidingRows: StoryObj<{wideBorder: false,edgeBorder: 'none',dividers: 'rows',+ muted: false,},- render: ({themed, rowBorder, wideBorder, edgeBorder, dividers}) => {+ render: ({themed, rowBorder, wideBorder, edgeBorder, dividers, muted}) => {const containerRef = useRef<HTMLDivElement>(null);const animatedLayout = useAnimatedLayout({containerRef});const [expandedKeys, setExpandedKeys] = useState<Set<string>>(@@ -255,6 +258,7 @@ export const GlidingRows: StoryObj<{getRowKey: item => item.id,renderExpanded: item => <OrderItems order={item} />,animatedLayout,+ panelVariant: muted === true ? 'muted' : 'transparent',});const sticky = useTableStickyColumns<Order>({startKeys: ['customer']});const wideColumns = useMemo(diff --git a/docs/specs/components/Table/Table.spec.md b/docs/specs/components/Table/Table.spec.mdindex dde5591451..2800a08e76 100644--- a/docs/specs/components/Table/Table.spec.md+++ b/docs/specs/components/Table/Table.spec.md@@ -221,7 +221,7 @@ Consumer data, columns, props, module signatures and usage remain documented in| FR12 | When built-in and named plugin references are unchanged, Table reuses the resolved plugin array; unknown/custom plugin value identity and insertion order remain stable inputs to memoization. | Current source and performance tests | Current performance contract; focused named-order coverage is partial || FR13 | In data-driven mode, each explicit column whose `width` is omitted keeps one equal flexible share and a 60px readability floor. A column sets its own floor with `proportional(value, {minWidth})`, which replaces the 60px floor for that column; Table has no table-wide floor setting. Resolution is a pure function of the final column definitions: row values, rendered header/body measurement, locale, sorting, filtering, virtualization, and loading state do not change any floor. Explicit pixel and proportional widths retain their authored floors. When the resolved floors exceed available inline space, the existing Scroll region provides horizontal overflow. | `component:Table/DEC-2`; current source and tests | Verified by width-resolution unit coverage and the ResponsiveScroll real-browser geometry fixture || FR14 | Wherever Table shows a row divider, including while rows glide and in pinned columns, the divider has the width, style and colour the row's border would have: the theme's tokens and any app override on `tr`, `tbody` or `td` borders, so customizations still show. | `component:Table/DEC-3` | Verified by row-expansion glide unit coverage and real-browser divider checks, pinned cells and an open panel included; a transient 1 px WebKit pinned-cell step is a recorded gap |-| FR15 | `useTableRowExpansion` takes an `animatedLayout` option, the handle `spec:AST-105` FR1 defines: when an Expanded detail row opens, the panel plays in and the rows after it glide to their new places; when one closes, it hides at once and the rows after it glide up into its space (`spec:AST-105` Coverage). The Expansion glyph turns on the same motion; under reduced motion the rows move without travel (`spec:AST-105` FR4). Without the option, rows change at once. A table that draws column lines (`dividers="grid"` or `"columns"`) does not glide yet: with the option its panel and rows change at once, as without it, and the glyph keeps its own turn. | `spec:AST-105` FR1, FR4; owner decision, 2026-10-26 | Opening and closing glides, the case without a handle, the glyph's turn, reduced motion and column lines are tested; the panel's entrance and its hide on close are source-inspected |+| FR15 | `useTableRowExpansion` takes an `animatedLayout` option, the handle `spec:AST-105` FR1 defines: when an Expanded detail row opens, the panel plays in and the rows after it glide to their new places; when one closes, it hides at once and the rows after it glide up into its space (`spec:AST-105` Coverage). The Expansion glyph turns on the same motion; under reduced motion the rows move without travel (`spec:AST-105` FR4). Without the option, rows change at once. A table that draws column lines (`dividers="grid"` or `"columns"`) does not glide yet: with the option its panel and rows change at once, as without it, and the glyph keeps its own turn. A `panelVariant="muted"` panel paints its wash on its cell, so the wash slides in with the panel's content (`spec:AST-105` FR9). | `spec:AST-105` FR1, FR4, FR9; owner decision, 2026-10-26 | Opening and closing glides, the case without a handle, the glyph's turn, reduced motion and column lines are tested; the panel's entrance and its hide on close are source-inspected || FR16 | Activation and windowing use one explicit canonical `idKey`. Property keys resolve valid strings/finite numbers through the existing string projection; function keys retain string/finite-number type. Missing, null, nonprimitive, nonfinite and duplicate values are invalid for these opt-ins. Table validates the complete logical dataset on data/key changes and supplies status; activation is inert on invalid rows and windowing falls back to full rendering. Internal type-tagged reconciliation keys distinguish numeric `0` from string `"0"` without changing callback equality. Invalid fallback keys are deterministic per record but promise no preserved state under invalid identity. Legacy keys without these opt-ins remain unchanged. | DEC-4; identity and compatibility boundary | Specified; release verification required || FR17 | Table supplies immutable `TableRowContext` and `TableRenderContext` rather than requiring module extractors or DOM mode inference. Row model and whole-row owner declarations precede eligibility/element transforms. Flat capability admission excludes tree/grouped/detail/custom structural output and unknown body modifiers without a compatible declaration. First-party `useTableSelection` and `useTableStickyColumns` declare `rowModel: 'flat'`; their selection cells and pinned-cell wrappers preserve flat product-row structure. More than one whole-row owner claim, including repeated activation entries, neutralizes activation in either plugin order, preserves the old owners and non-owning handlers, and emits one development diagnostic. A custom callback that owns a whole-row action must declare it; Table never infers arbitrary callback intent. | DEC-4; shared protocol | Specified; release verification required || FR18 | `Table.virtualization` is an opaque geometry capability; runtime admission requires data mode, explicit identity and constrained content together. The optional prop preserves the exported Table props interface; invalid combinations take the diagnostic full-render fallback. Table resolves complete input order, columns and identity, then plans mounted keyed records and inaccessible gaps before cell construction. Only mounted product/focus-island records enter element transforms. Default virtualized cells use existing single-line `textOverflow="truncate"`; explicit wrap, arbitrary row/cell renderers or unsafe structural output falls back to full rendering. Without opt-in, default wrapping and ordinary rendering remain unchanged. | DEC-5; native rendering and bounded work | Specified; release verification required |@@ -255,10 +255,6 @@ Consumer data, columns, props, module signatures and usage remain documented inpositions of the gliding row, the two parts round to different pixels. The steplasts only while the row glides; at rest the divider is level. This contractrecords the gap and does not correct it.-- An expanded panel row with `panelVariant="muted"` paints its own box and- keeps the moving clip, so on iOS WebKit it can drift from the rows below for a- few frames; AST-105 FR9's slide doesn't apply to an element that paints its- own box.### Allowed variation@@ -457,7 +453,7 @@ for this aggregate ownership.| FR12, PR1 | `Table.perf.test.tsx` plus `useBaseTablePlugins.ts` source inspection | Same plugin references, recreated record, and changed plugin value | Unchanged plugin values must preserve the resolved array and representative no-op row-update budgets; focused named-record identity coverage remains partial. | `audit:Table/performance` || FR13, PR3 | `Table.test.tsx`, `plugins/columnResize/useTableColumnResize.test.tsx`, `plugins/stickyColumns/useTableStickyColumns.test.tsx`, and `Table.stories.tsx` ResponsiveScroll play assertions | Width-less columns with empty, short, and long-token rows; mixed explicit widths; pinned columns; narrow and fitting containers | Removing the 60px floor, deriving it from row content, changing explicit width semantics, desynchronizing resize bounds or sticky offsets, or preventing the existing Scroll region from activating fails focused unit or real-browser geometry assertions. | `audit:Table/layout` || FR14 | `__tests__/TableRowGlide.a11y.browser.spec.ts` screenshot checks of the divider mid-glide, in pinned columns, and under an open detail panel; `plugins/rowExpansion/useTableRowExpansion.glide.test.tsx` for the divider an open panel carries | a theme with a custom divider colour; an app override of a row's border; both mid-glide and on a pinned cell; an open detail panel's divider under the same theme and override | a divider whose width, style or colour differs from the row's border, or that drops a theme or app override, fails | `audit:Table/theming` |-| FR15 | `plugins/rowExpansion/useTableRowExpansion.glide.test.tsx` and `__tests__/TableRowGlide.a11y.browser.spec.ts`: row expansion with and without `animatedLayout`, plus source inspection of the panel's entrance and its hide on close | open and close with the handle; without it; reduced motion under a coarse and a fine pointer; a glyph turn beside the glide; a `dividers="grid"` and a `dividers="columns"` table with the option | rows that jump with the handle in a table without column lines, a closing panel that animates or leaves its space empty before the rows arrive, a panel and rows on different motion, a glyph on its own timing beside the glide, travel under reduced motion, or any motion without the handle a table with column lines that glides or animates its panel, or one whose glyph does not keep its own turn, fails | `audit:Table/plugins` |+| FR15 | `plugins/rowExpansion/useTableRowExpansion.glide.test.tsx` and `__tests__/TableRowGlide.a11y.browser.spec.ts`: row expansion with and without `animatedLayout`, plus source inspection of the panel's entrance and its hide on close | open and close with the handle; without it; reduced motion under a coarse and a fine pointer; a glyph turn beside the glide; a `dividers="grid"` and a `dividers="columns"` table with the option; a muted panel mid-open | rows that jump with the handle in a table without column lines, a closing panel that animates or leaves its space empty before the rows arrive, a panel and rows on different motion, a glyph on its own timing beside the glide, travel under reduced motion, or any motion without the handle a table with column lines that glides or animates its panel, or one whose glyph does not keep its own turn, fails | `audit:Table/plugins` || Accessibility contract | `__tests__/Table.a11y.test.tsx` and `__tests__/Table.a11y.chromium.spec.ts` bind Table to the base Table contract (`internal/a11y-spec`), composing each module's contract only for the states rendered with that module: the sort module contract (`plugins/sortable/__tests__/useTableSortable.a11y.ts`) for the sorted state; `__tests__/TableScroll.a11y.chromium.spec.ts` keeps the Scroll region evidence | Labelled data-driven, sorted descending, composed RTL with row headers, and empty data | Losing the table role or declared name, row, header, or cell roles, or a part leaving its row or the table, fails the base binding; a missing or stale `aria-sort` fails the composed sort module contract. | `audit:Table/accessibility` || FR17 transform context | `TableRowContext.test.tsx` and `plugins/rowIndex/useTableRowIndex.test.tsx`: row, cell and scroll-wrapper contexts, row-model admission, read-tracked re-rendering, and row numbering from the context | Keys with and without `idKey`; flat, undeclared and declared row models; a re-sort with and without an index read; an appended row with a count read; numbering after a re-sort without `data` | A missing or mutable context, a renumbered or stale index, a moved row re-rendered for a plugin that never reads its index, or numbering from a data lookup fails | `audit:Table/plugins` || FR16-FR22 | Pending parent protocol, render-count, API-compile, lifecycle and browser tests plus the module verification maps | Canonical type/key collisions; first-party flat declarations and diagnostic full-render fallbacks; invalid/unknown modes; both owner orders; optional context arities; full/empty/loading/windowed data; pinned paint; native focus and no-op frames | A second key/offset/renderer, order-selected owner, full cell work before slicing, stale source/ref, empty-loading contradiction, or removed focus destination fails | `audit:Table/plugins` |diff --git a/packages/core/src/Table/__tests__/TableRowGlide.a11y.browser.spec.ts b/packages/core/src/Table/__tests__/TableRowGlide.a11y.browser.spec.tsindex 011e405d81..ccd72b6012 100644--- a/packages/core/src/Table/__tests__/TableRowGlide.a11y.browser.spec.ts+++ b/packages/core/src/Table/__tests__/TableRowGlide.a11y.browser.spec.ts@@ -141,6 +141,29 @@ async function darkestNear(page: Page, x: number, y: number): Promise<Rgb> {}, shot.toString('base64'));}+/** The pixel at `x`, `y`. */+async function colorAt(page: Page, x: number, y: number): Promise<Rgb> {+ const shot = await page.screenshot({+ clip: {x, y, width: 1, height: 1},+ scale: 'css',+ });+ return page.evaluate(async b64 => {+ const image = new Image();+ image.src = `data:image/png;base64,${b64}`;+ await image.decode();+ const canvas = document.createElement('canvas');+ canvas.width = 1;+ canvas.height = 1;+ const context = canvas.getContext('2d');+ if (context == null) {+ return [255, 255, 255];+ }+ context.drawImage(image, 0, 0);+ const [r, g, b] = context.getImageData(0, 0, 1, 1).data;+ return [r, g, b];+ }, shot.toString('base64'));+}+/** Where a body row's divider is now, under its pinned and an unpinned cell. */async function rowBottom(page: Page, index: number) {return page.evaluate(i => {@@ -225,6 +248,46 @@ test("mid-open the panel's divider rides its cell's bottom", async ({page}) => {);});+test("mid-open a muted panel's wash slides in with its cell, and the divider rides the cell's bottom", async ({+ page,+}) => {+ await mount(page, 'gliding-rows', '&args=muted:!true');+ expect(await toggleAndHold(page, 0, 90)).toBeGreaterThan(0);+ const panel = await page.evaluate(() => {+ const row = document.querySelector('tr[data-expansion-panel]');+ const cell = row?.firstElementChild ?? null;+ const animates = (element: Element | null | undefined) =>+ (element?.getAnimations() ?? []).flatMap(animation =>+ Object.keys(+ (animation.effect as KeyframeEffect | null)?.getKeyframes()[0] ?? {},+ ),+ );+ const box = cell?.getBoundingClientRect();+ return {+ row: animates(row),+ cell: animates(cell),+ at:+ box == null+ ? null+ : {+ x: Math.round((box.left + box.right) / 2),+ y: Math.round(box.bottom),+ },+ };+ });+ // The row paints nothing, so its clip stays still and the cell slides. A+ // clip that moves with the edge can trail the rows below it on iOS.+ expect(panel.row).not.toContain('clipPath');+ expect(panel.cell).toContain('translate');+ expect(panel.at, 'the panel cell').not.toBeNull();+ const x = panel.at?.x ?? 0;+ const y = panel.at?.y ?? 0;+ // The wash shows where the cell is now, and the line under it is darker.+ const wash = await colorAt(page, x, y - 8);+ expect(wash[0], 'the wash').toBeLessThan(250);+ expect((await darkestNear(page, x, y))[0]).toBeLessThan(wash[0] - 8);+});+test("a theme's divider and an app's override move with their rows, pinned cells included", async ({page,}) => {diff --git a/packages/core/src/Table/plugins/rowExpansion/useTableRowExpansion.test.tsx b/packages/core/src/Table/plugins/rowExpansion/useTableRowExpansion.test.tsxindex cf840e4723..d7d7a7bb08 100644--- a/packages/core/src/Table/plugins/rowExpansion/useTableRowExpansion.test.tsx+++ b/packages/core/src/Table/plugins/rowExpansion/useTableRowExpansion.test.tsx@@ -527,21 +527,24 @@ describe('useTableRowExpansion (detail panel)', () => {describe('panel variant', () => {const panelRow = () =>screen.getByTestId('panel').closest('tr') as HTMLTableRowElement;+ const panelCell = () =>+ screen.getByTestId('panel').closest('td') as HTMLTableCellElement;+ const wash = {backgroundColor: 'var(--color-background-muted)'};it('leaves the panel on the surface behind the table by default', () => {// The panel is the row's continuation, not a surface of its own: it// takes whatever the table sits on, the way the row does.render(<Harness initialExpanded={new Set(['a'])} />);- expect(panelRow()).not.toHaveStyle({- backgroundColor: 'var(--color-background-muted)',- });+ expect(panelRow()).not.toHaveStyle(wash);+ expect(panelCell()).not.toHaveStyle(wash);});- it('washes the panel when muted is asked for', () => {+ it('washes the panel cell, not its row, when muted is asked for', () => {+ // A row that paints its own box keeps a moving clip as the panel plays+ // in. The cell slides in with the content instead.render(<Harness initialExpanded={new Set(['a'])} panelVariant="muted" />);- expect(panelRow()).toHaveStyle({- backgroundColor: 'var(--color-background-muted)',- });+ expect(panelCell()).toHaveStyle(wash);+ expect(panelRow()).not.toHaveStyle(wash);});});diff --git a/packages/core/src/Table/plugins/rowExpansion/useTableRowExpansion.tsx b/packages/core/src/Table/plugins/rowExpansion/useTableRowExpansion.tsxindex f5cdb9c4d7..0bf54c931e 100644--- a/packages/core/src/Table/plugins/rowExpansion/useTableRowExpansion.tsx+++ b/packages/core/src/Table/plugins/rowExpansion/useTableRowExpansion.tsx@@ -255,7 +255,11 @@ const expansionStyles = stylex.create({':is([dir="rtl"] *)': 'scaleX(-1) rotate(0deg)',},},- expandedRow: {+ // The wash goes on the panel's cell, not on its row. A row that paints its+ // own box plays in under a clip that moves with its edge. On iOS that clip+ // can trail the rows that glide below it. The cell slides in with the+ // panel's content.+ mutedPanel: {backgroundColor: colorVars['--color-background-muted'],},expandedCell: {@@ -506,10 +510,12 @@ function PanelDividerModeWatch({function ExpansionPanelCell({colSpan,cellsRef,+ isMuted,children,}: {colSpan: number;cellsRef: RefObject<Set<HTMLTableCellElement>>;+ isMuted: boolean;children: ReactNode;}) {const ctx = useTableContext();@@ -559,6 +565,7 @@ function ExpansionPanelCell({colSpan={colSpan}{...stylex.props(expansionStyles.expandedCell,+ isMuted && expansionStyles.mutedPanel,panelIndentStyles[ctx?.density ?? 'balanced'],hasRowDividers && dividerStyles.panelCell,glidingDividerStyles.cell,@@ -1104,12 +1111,12 @@ export function useTableRowExpansion<T extends Record<string, unknown>>(// Carries the marker so the panel cell's divider can ask whether// this row is the table's last, the same way TableCell does.tableRowMarker,- panelVariant === 'muted' && expansionStyles.expandedRow,glidingDividerStyles.row,)}><ExpansionPanelCellcolSpan={columnCountRef.current}- cellsRef={panelCellsRef}>+ cellsRef={panelCellsRef}+ isMuted={panelVariant === 'muted'}>{renderExpanded(item)}</ExpansionPanelCell></tr>