Repository navigation
TreeDataGrid: type onCellKeyDown and onActivePositionChange with group rows, and export isGroupRow - #4265
Merged
Conversation
This was referenced Oct 27, 2026
TreeDataGrid: type onCellKeyDown and onActivePositionChange with group rows, and export isGroupRow
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4265 +/- ##
=======================================
Coverage 99.27% 99.27%
=======================================
Files 44 44
Lines 2213 2213
Branches 971 971
=======================================
Hits 2197 2197
Misses 16 16
🚀 New features to boost your workflow:
|
nstepien
force-pushed
the
breaking/tree-group-rows-in-callbacks
branch
from
October 28, 2026 22:52
3640afb to
6bd1d78
Compare
nstepien
force-pushed
the
breaking/tree-group-rows-in-callbacks
branch
3 times, most recently
from
October 29, 2026 02:18
fb6fdd3 to
21259a2
Compare
…p rows, and export isGroupRow `TreeDataGrid` passes group rows to `onCellKeyDown` and `onActivePositionChange` when a group row, or a cell of one, is active, but their `row` was typed as `R`. `CellKeyDownArgs` and `PositionChangeArgs` get a third type parameter for the active row's type, `TreeDataGridProps` types the two callbacks with the new `TreeCellKeyDownArgs` and `TreePositionChangeArgs` aliases, and `isGroupRow` is exported to narrow the row. `DataGrid` handlers are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
nstepien
force-pushed
the
breaking/tree-group-rows-in-callbacks
branch
from
October 29, 2026 02:20
21259a2 to
1043e46
Compare
The runtime test passes handlers typed with `TreeCellKeyDownArgs` and `TreePositionChangeArgs` to the grid, and narrows their rows with `isGroupRow`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
TreeDataGridpasses its group rows toDataGridasR, so when a group row, or a cell of one, is active,onCellKeyDownandonActivePositionChangereceive aGroupRowtyped asR: a property access likeargs.row.name.toUpperCase()type-checks and throws at runtime. Theirrowis now typedR | GroupRow<R>, andisGroupRowis exported so handlers can narrow it. Like #4219, this makes the types say what happens.Builds on #4264.
Breaking change
Affects
TreeDataGrid'sonCellKeyDownandonActivePositionChangehandlers: theirrowis typedR | GroupRow<R>, which is what the grid passed all along when a group row was active.isGroupRowis exported to narrow it.DataGridhandlers are unchanged.Changes
CellKeyDownArgsandPositionChangeArgsget a third type parameter,TActiveRow, which defaults toTRow, soDataGridhandler types are unchanged. It only applies to theACTIVEvariant ofCellKeyDownArgs:EditCellis only rendered throughRow, never throughGroupedRow, soEDITargs never carry a group row.TreeCellKeyDownArgs<R, SR>andTreePositionChangeArgs<R, SR>, keep handlers short. The third type parameter stays public and is documented next to them.TreeDataGridPropsomits the two inherited props and redeclares them with the aliases;TreeDataGrid's ownhandleKeyDownusesTreeCellKeyDownArgs. Passing them on toDataGridtype-checks because function parameters are contravariant.isGroupRowis exported fromTreeDataGrid.tsx, where it stays with itsWeakSet:DataGriddoesn't use it, so exporting it from there creates no import cycle. If the group-row edit-mode bug below gets fixed inDataGrid, that PR can move both to a shared module.rows as R[]cast stays, and itsTODOcomment now explains which callbacks receive group rows.isGroupRowunder "Other", the aliases and the third type parameter under "Types",onCellKeyDownandonActivePositionChangeunderTreeDataGridProps, and a "Group rows in callbacks" paragraph with an example under<TreeDataGrid />. TheCellKeyDownArgsandPositionChangeArgsheadings gainTActiveRow, so their anchors changed and the links to them are updated.rowClass(not applied to group rows),onCellCopyandonCellPaste(filtered),renderers.renderRowandrenderCell(wrapped),rowHeight(RowHeightArgs), andonRowsChange(indexes mapped back).Follow-ups
renderEditCellsetsmode: 'EDIT'with the group row; no editor renders, and the arrow keys stop working until a click. That fix gets its own PR.Verification
vp run cipasses on the top of the stack (#4272). Added a browser test that activates a group row, then a cell of it, then a cell of a regular row, and asserts which rowsonCellKeyDownandonActivePositionChangereceived, usingisGroupRow. A consumer type-check of the builtlib/index.d.ts, with and withoutexactOptionalPropertyTypes, usesTreeCellKeyDownArgs,TreePositionChangeArgs,isGroupRow,GroupRow,expandedGroupIds, andrenderGroupCell.🤖 Generated with Claude Code