feat(grid): spreadsheet-style keyboard selection and header column select - #683
Open
debba wants to merge 1 commit into
Open
feat(grid): spreadsheet-style keyboard selection and header column select#683debba wants to merge 1 commit into
debba wants to merge 1 commit into
Conversation
…lect Adds Google Sheets style selection shortcuts to the data grid, relative to the focused cell: Shift+Arrow extends a cell range, Ctrl/Cmd+Arrow jumps to the grid edge, Ctrl/Cmd+Shift+Arrow extends the range to the edge, Ctrl/Cmd+Home/End go to the first/last cell, Shift+Space selects the row(s) and Ctrl/Cmd+Space (or Ctrl/Cmd+Shift+Space, for systems where Ctrl+Space is taken by the IME or Spotlight) selects the column(s). A plain click on a column header now selects the column; sorting moves to the sort icon, which becomes a proper button. Ctrl/Cmd+click toggling and Shift+click range selection are unchanged. The range logic is extracted into pure helpers in utils/dataGrid.ts with unit tests, and the new bindings are listed in the Shortcuts settings tab. Closes #673
2 tasks
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.
Closes #673
What changed
Spreadsheet-style (Google Sheets) selection shortcuts in the data grid. All of them are relative to the focused cell (single click or arrow navigation):
Ctrl+Shift+Space is offered as an alternative because plain Ctrl+Space is often consumed before it reaches the app (ibus/fcitx on Linux, Spotlight on macOS).
Header changes:
<button>with the sort aria-label/title. It is still revealed on hover as before.Row, column and cell-range selection stay mutually exclusive, so Ctrl+C keeps unambiguous copy semantics. The focused cell is kept after Shift/Ctrl+Space so shortcuts can be chained (for example Shift+Down three times, then Shift+Space, selects four rows).
Other:
src/utils/dataGrid.ts(buildCellRange,getRangeCursor,moveCellPosition,extendCellRange);handleCellClickreusesbuildCellRange.shortcuts.json, non overridable), with strings in all 11 locales.Behaviour changes to be aware of
next_page/prev_pageshortcuts still work when no cell is focused, and from the pagination buttons. If we prefer to avoid the overlap entirely, the pagination defaults could move to another combination (they are user overridable).Verification
pnpm test --run: 235 files, 3892 tests passing (new unit tests for the range helpers and component tests for every new shortcut and the header click behaviour)pnpm lint: 0 errors (one pre-existing warning inThemeProvider.tsx, untouched)pnpm build: okManual testing still needed on Linux with an IME configured and on macOS, to confirm the Ctrl+Space fallback story.