Repository navigation
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
be95259 to
1fdd0f5
Compare
|
AI review status for this pull request.
|
There was a problem hiding this comment.
Thanks for splitting the decision surface out and writing the trade-offs down — the panel alignment, panelVariant, and row-click work reads clearly, and the committed suite covering indent, variant, and the toggle/guard matrix passes.
I'm holding approval for a maintainer decision: there's no plugin spec recording the rowExpansion combinations (striping, selection, groupedRows, stickyColumns, dividers), so panelVariant's default flip and hasRowClickExpansion — including how row-click interacts with the selection plugin — don't have governing authority yet. Either a pointer to the spec that covers this surface, or a design-only plugin spec record first, would clear it.
Worth keeping visible alongside: the leading-column assumption in the panel indent and the 1px context-menu shortfall, until their follow-ups land.
[Automated review]
Changeset complianceOne release entry needs correction before merge:
Also update the three moved entries that still cite |
|
Closing — folded back into #5995. The split was meant to let the three uncontested fixes move while the API questions were settled. It does not achieve that: both halves need an approval from a Table Everything here is now on #5995, unchanged. The open questions this PR's description raised — the leading-column assumption in the panel indent, whether No content is lost by this close; branch |
What
The half of #5995 that adds public surface or changes a released default. Stacked on #5995 — review that one first; this branch targets it, not
main.fixfeatpanelVariant— opt the panel's wash out, and flip the defaultfeathasRowClickExpansion— the whole row toggles, as inuseTableTreeDatafixSplit out so the three uncontested repairs in #5995 are not held behind the decisions here. Two change requests are open against this material and are addressed below, except where they are genuinely open questions for an owner.
Open, and needing a decision
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(columnCountRefis captured intransformColumns, 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.
hasRowClickExpansionand the selection plugin. cixzhang asked this to match the selection plugin's row-click option.useTableSelectionhas no row-click option today; the one precedent isuseTableTreeData.hasRowClickExpansion, which this copies exactly — same name, samefalsedefault, 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.fix — the panel started at the row edge
The panel is one cell spanning the whole row with a flat
20pxinline 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: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))atbalanced. 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 insidetransformBodyRow, outside the Table's own render, so the context is not otherwise in hand. (#5995 already introduces that component to carry the row divider; this adds the indent to it.)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 = 40stays 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 tospacingDefaults['--spacing-10']— the two silently drifting apart would unalign the panel.Known limit: see open question 1 above.
The indent also 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.TableCellrelocates 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-linepadding: 0inTableCell, 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.feat —
panelVariantThe 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 aCardno longer stacks a third surface, and a striped table no longer paints a band in the same token as its own stripe, which read as a data row rather than as a detail.'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)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-mutedand--color-background-cardresolve to the same value there, so dark has effectively been renderingtransparentall 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 —
hasRowClickExpansionuseTableTreeDataalready 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 offalse, so nothing changes for existing callers.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.
fix — share the clickable-container guards
Both expansion plugins carried their own copy of the nine-selector "did this click belong to something else" check.
useClickableContaineralready 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 insidetransformBodyRowhas none to hand it, so this exports the two guards it is built from —hasInteractiveAncestorandhasTextSelection— and calls those from both plugins. One definition, three callers.This is the part that adds surface without looking like it. Two new exports on the
hooksbarrel are a public promise, and R1g-surface judges an export the same way it judges a prop. Worth saying plainly rather than filing as a dedupe.Two behaviour fixes fall out of sharing:
role="tab", a segmentedrole="radio", aSliderin a cell — no longer toggles the row underneath it.Test plan
vitest run packages/core/src/Table packages/core/src/hooks— 568 passed across 26 Table files on the stack.tsc --noEmitandeslintclean; full pre-commit check suite green.calc(--spacing-10 + var(--spacing-3))at the default density; followsdensityto--spacing-4atspacious; the chevron column's width is pinned tospacingDefaults['--spacing-10'].mutedis asked for.cursor: pointeronly when wired up.Four 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 allhasRowClickExpansioncomposition, and they want the shape questions above settled first, since the answer to "which plugin owns the click" decides several of them.