Skip to content

Commit 85f6132

Browse files
Fix cell selection when using shift + arrow keys (#10776)
* changes * add changeset * changes * add changeset * remove console --------- Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
1 parent c44b8f4 commit 85f6132

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

.changeset/yellow-paws-grin.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"@gradio/dataframe": patch
3+
"gradio": patch
4+
---
5+
6+
feat:Fix cell selection when using shift + arrow keys

js/dataframe/shared/selection_utils.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,14 @@ export function get_range_selection(
3737
const max_col = Math.max(start_col, end_col);
3838

3939
const cells: CellCoordinate[] = [];
40+
// Add the start cell as the "anchor" cell so that when
41+
// we press shift+arrow keys, the selection will always
42+
// include the anchor cell.
43+
cells.push(start);
44+
4045
for (let i = min_row; i <= max_row; i++) {
4146
for (let j = min_col; j <= max_col; j++) {
47+
if (i === start_row && j === start_col) continue;
4248
cells.push([i, j]);
4349
}
4450
}

0 commit comments

Comments
 (0)