Repository navigation
Conversation
`DataGrid` always renders `role="grid"` and `TreeDataGrid` `role="treegrid"`. Tree-grid behavior is driven by a module-private `TreeGridContext` that `TreeDataGrid` provides, and that `DataGrid` resets for its own children so a grid nested in a cell isn't a tree grid. In a `TreeDataGrid`, the active row's `tabIndex` and `rdg-row-active` class reach row renderers as DOM props. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4268 +/- ##
=======================================
Coverage 99.27% 99.27%
=======================================
Files 44 45 +1
Lines 2204 2210 +6
Branches 965 972 +7
=======================================
+ Hits 2188 2194 +6
Misses 16 16
🚀 New features to boost your workflow:
|
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This branch has not been 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.
DataGridno longer accepts aroleprop, and custom row renderers no longer receiveisTreeGrid.DataGridderived its tree-grid behavior fromrole === 'treegrid', so passingrole="treegrid"turned on half of it (focusable rows, row positions) without any grouping, and any other value broke the ARIA structure; there was no valid value to pass.RenderRowProps.isTreeGridleaked the same internal flag into the public row renderer props. Tree-grid behavior is now driven by an internal signal fromTreeDataGrid.Supersedes the
isTreeGridpart of #3976; itsrenderSummaryRowaddition is out of scope here.Breaking change
roleis no longer a prop:DataGridalways hasrole="grid"andTreeDataGridrole="treegrid". Custom row renderers no longer receiveisTreeGrid; in aTreeDataGrid, the active row'stabIndexandrdg-row-activeclass arrive as DOM props, so spread them onto the row element.Changes
TreeGridContext(createContext(false), not exported fromsrc/index.ts) replaces therolecheck.TreeDataGridprovidestruearound itsDataGrid, andDataGridreads it forisTreeGrid, rendersrole={isTreeGrid ? 'treegrid' : 'grid'}, and providesfalseto its own children, so aDataGridrendered in a cell of aTreeDataGridstays a plain grid. Thefalseprovider wraps the children insideDataGridRenderersContext, which re-indents that block; the diff reads better with whitespace hidden.RowandSummaryRowno longer computetabIndexor therdg-row-activeclass.TreeDataGrid'srenderRowwrapper passes them as DOM props (tabIndex,className) to the user's or the defaultrenderRow, andRowalready mergesclassNameand spreads the rest.DataGridpasses the same toSummaryRowthrough internal props when it's a tree grid.GroupedRowkeeps its own logic.rdg-row-activeclass fromHeaderRow: navigation never puts the row position on the header row.TreeDataGridPropsno longer omitsrole, and the README drops theroleprop, theTreeDataGrid"Unsupported Props" bullet, andisTreeGridfromRenderRowProps; therenderers.renderRowdocs now say that a custom renderer rendering its own row element must spread the DOM props it receives.<TreeGrid />, addrenderSummaryRow#3976, this keeps the row focus styles inrdg.Rowinstead of moving them to a separaterowFocusableclass, to keep the diff to the behavior change.Verification
vp run cipasses. Added totest/browser/TreeDataGrid.test.tsx:DataGridin a cell of aTreeDataGridhasrole="grid", its rows and summary rows have notabindex, and ← on its first cell keeps the cell active; this test fails whenDataGridforwards the context instead of resetting it;renderRowthat renders its own row element and spreads the DOM props gets a focusable active row in aTreeDataGrid;expectTypeOfchecks thatDataGridPropsandTreeDataGridPropshave noroleandRenderRowPropshas noisTreeGrid.The existing tree grid row focus tests pass unchanged. I also type-checked a consumer of the built
lib/index.d.tswithtsc --strict, with and without--exactOptionalPropertyTypes:roleis rejected onDataGridandTreeDataGrid, andisTreeGridis absent fromRenderRowProps.🤖 Generated with Claude Code