Repository navigation
feat(core): Table tree whole-row-click expansion (#4142) - #4548
Merged
Merged
Conversation
Fold useTableRowExpansion's whole-row-click affordance into useTableTreeData as an opt-in `hasRowClickExpansion` prop. When set, clicking anywhere on an expandable row toggles it, in addition to the chevron. The row handler ignores clicks that originate from interactive cell content (buttons, links, form controls, e.g. a composed selection checkbox) and clicks that produced a text selection, so it composes cleanly with the other Table plugins. Keyboard and assistive-tech users continue to toggle via the chevron button, which stays the accessible control. Leaf rows stay inert and the whole feature is a no-op on flat data. Second step of the tree-plugin convergence: with expand-all and row-click both folded in, useTableTreeData now covers useTableRowExpansion's affordances on a stronger base (fine-grained re-render, cycle guard, row ARIA).
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
PR Analysis Report📚 Storybook PreviewView Storybook for this PR 🧪 Sandbox PreviewView Sandbox for this PR Modified ComponentsTable · View in Storybook
Bundle Size Summary
Accessibility AuditStatus: 1 accessibility violation(s) found — 1 serious. Table - 1 issue(s)
Generated by PR Enrichment workflow | Storybook | Sandbox | View full report |
humbertovirtudes
marked this pull request as ready for review
July 31, 2026 08:39
humbertovirtudes
requested review from
cixzhang,
ejhammond and
imdreamrunner
as code owners
July 31, 2026 08:39
humbertovirtudes
added a commit
that referenced
this pull request
Jul 31, 2026
…4142) (#4584) The tree plugins are converging: useTableTreeData + useTableTreeState now cover useTableRowExpansion's affordances (expand-all header control #4172, whole-row click #4548) with a cycle guard and fine-grained re-render. Add a migration guide to the useTableRowExpansion docs so consumers have a clear path to the surviving plugin: - a before/after example (useTableRowExpansion + State -> useTableTreeState + useTableTreeData) - a full config mapping (baseData -> data, getChildren -> childrenKey, getRowKey -> idKey, getDepth removed, isAllExpanded/onToggleExpandAll -> hasExpandAllControl, hasRowClickExpansion unchanged) Surfaces via `astryx component useTableRowExpansion --detail full` and the docs pipeline. Deprecation and removal follow in later changes.
humbertovirtudes
added a commit
that referenced
this pull request
Jul 31, 2026
…4142) (#4587) Fourth step of the tree-plugin convergence. useTableTreeData + useTableTreeState now cover useTableRowExpansion's affordances (expand-all header control #4172, whole-row click #4548) with a cycle guard and fine-grained re-render, and the migration guide landed in #4584. Mark the older plugin deprecated without removing it: - @deprecated JSDoc on useTableRowExpansion and useTableRowExpansionState (and the file header), each pointing to the tree plugin and the migration guide. - Prefix the doc.mjs descriptions with "Deprecated: use useTableTreeData + useTableTreeState instead", so it shows in the docs and via `astryx component useTableRowExpansion`. The hooks still work; existing consumers are unaffected. Removal and a version-keyed codemod follow in a later release.
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Second step of the tree-plugin convergence tracked in #4142: fold
useTableRowExpansion's whole-row-click affordance intouseTableTreeDataas an opt-inhasRowClickExpansionprop. (The header expand-all control was the first step, #4172.)When set, clicking anywhere on an expandable row toggles its expansion, in addition to the chevron.
What changed
useTableTreeData: newhasRowClickExpansion?: booleanprop (defaultfalse). When enabled,transformBodyRowattaches anonClickto expandable rows plus aclickableRow(cursor: pointer) style. Leaf rows stay inert and the whole feature is a no-op on flat data.button, a, input, select, textarea, [role="button"], [role="checkbox"], [contenteditable]) and clicks that produced a text selection. So composing with the selection plugin, a checkbox click selects the row without toggling expansion. The chevron already stops propagation, so it never double-toggles.Why converge here
Per #4142,
useTableTreeDatais the stronger base to keep (fine-grained per-row re-render, cycle guard, imperative row ARIA). With expand-all (#4172) and now row-click folded in, it coversuseTableRowExpansion's affordances. Notably, the older plugin has no guard against nested interactive content or text selection on its row-click; this port adds both, so we converge toward the more correct behavior rather than porting the gap forward.Test plan
useTableTreeData.test.tsx(8 cases): prop off (inert), expand on body click, collapse on body click, leaf inert, chevron single-toggle (spy assertstoHaveBeenCalledTimes(1)), no-op on flat data, and composition with the selection checkbox (checkbox click does not toggle).Core/TableTree > RowClickExpansion.pnpm -F @astryxdesign/core test(tree suite 77 passing),typecheck,typecheck:docs, and storybooktypecheckall green.