Repository navigation
Clamp column spans, and add getColSpan() to calculated columns - #4251
Merged
Merged
Conversation
Cells validate the span returned by a column's `colSpan` with `getColSpan()`, but the drag handle called `colSpan` directly. When `getColSpan()` ignored a span, e.g., one that would cross into the end-frozen columns, the cell spanned one column, and the drag handle showed up at the end of the last column the span would have covered. Split from #4005. 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 #4251 +/- ##
==========================================
+ Coverage 99.13% 99.22% +0.09%
==========================================
Files 46 44 -2
Lines 2207 2207
Branches 977 971 -6
==========================================
+ Hits 2188 2190 +2
+ Misses 19 17 -2
🚀 New features to boost your workflow:
|
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Now that getColSpan() returns 1 for cells that don't span, cells rendered aria-colspan="1": omit it again. mapViewportColumns passes 1 instead of undefined to its callback for these cells, and calculated columns have getColSpan, so update the tests that checked them. Add tests for spans clamped to the start-frozen, unfrozen, or end-frozen columns, and to the last column, and document the clamping and getColSpan(). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
When scrolling, the drag handle of a start-frozen cell sticks at the end of the cell's column, so it moved to the middle of cells that span columns. It now sticks at the end of the last column that the cell spans. Update the drag handle test for the clamped spans. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
getColSpan() for the drag handlegetColSpan() to calculated columns
…g demo Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- EditCell computes its span from the edited row with column.getColSpan(), instead of receiving it as a prop. - getColSpan() accepts undefined arguments, and returns 1 for them, so mapColumnsWithColSpan() doesn't need to check them. - getCellColSpan() only counts the top summary rows when the row isn't the header row. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ColumnFrozen is now false | 'start' | 'end'. Column.frozen still accepts true, as an alias for 'start', and calculated columns normalize it, so isStartFrozen() is gone. 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.
Calculated columns have a new
getColSpan(args)method, which returns the number of columns that a cell spans: the value returned by the column'scolSpan, clamped, or1. Cells, keyboard navigation, the editor, and the drag handle all use it, so they agree on each cell's span.Spans are clamped instead of ignored. A span is clamped to the start-frozen, unfrozen, or end-frozen columns, whichever the column is part of:
Drag handle fixes:
colSpandirectly. When the cells ignored a span, the drag handle still spanned the columns that the span would have covered, and showed up at the end of the last one.API changes:
CalculatedColumnhas a newgetColSpanmember.colSpaninRenderCellPropsand in the callback ofmapViewportColumnsis now always a number:1instead ofundefinedfor cells that don't span.aria-colspan.ColumnFrozenis nowfalse | 'start' | 'end'.Column.frozenstill acceptstrue, as an alias for'start', and calculated columns normalize it to'start'.Tests:
colSpan.test.tscheck that spans are clamped to each group of columns in the header row, rows, and summary rows, and to the last column.dragFill.test.tsxcheck that the drag handle straddles the end of a cell whose span is clamped, and the end of a start-frozen cell that spans columns, before and after scrolling.main.The drag handle fix was split from #4005.
vp run cipasses.🤖 Generated with Claude Code