Skip to content

Commit 29c765c

Browse files
waleedlatif1claude
andcommitted
fix(tables): move Escape and Cmd+A above anchor guard
Both shortcuts should work without a pre-selected cell. Cmd+A selects all rows via checkboxes; Escape clears all selection state. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 4ea4490 commit 29c765c

File tree

1 file changed

+23
-23
lines changed
  • apps/sim/app/workspace/[workspaceId]/tables/[tableId]/components/table

1 file changed

+23
-23
lines changed

apps/sim/app/workspace/[workspaceId]/tables/[tableId]/components/table/table.tsx

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -693,13 +693,6 @@ export function Table({
693693
return
694694
}
695695

696-
const anchor = selectionAnchorRef.current
697-
if (!anchor || editingCellRef.current) return
698-
699-
const cols = columnsRef.current
700-
const mp = maxPositionRef.current
701-
const totalRows = mp + 1
702-
703696
if (e.key === 'Escape') {
704697
e.preventDefault()
705698
setSelectionAnchor(null)
@@ -709,6 +702,29 @@ export function Table({
709702
return
710703
}
711704

705+
if ((e.metaKey || e.ctrlKey) && e.key === 'a') {
706+
e.preventDefault()
707+
const rws = rowsRef.current
708+
if (rws.length > 0) {
709+
setEditingCell(null)
710+
setSelectionAnchor(null)
711+
setSelectionFocus(null)
712+
const all = new Set<number>()
713+
for (const row of rws) {
714+
all.add(row.position)
715+
}
716+
setCheckedRows(all)
717+
}
718+
return
719+
}
720+
721+
const anchor = selectionAnchorRef.current
722+
if (!anchor || editingCellRef.current) return
723+
724+
const cols = columnsRef.current
725+
const mp = maxPositionRef.current
726+
const totalRows = mp + 1
727+
712728
if (e.shiftKey && e.key === 'Enter') {
713729
const row = positionMapRef.current.get(anchor.rowIndex)
714730
if (!row) return
@@ -783,22 +799,6 @@ export function Table({
783799
return
784800
}
785801

786-
if ((e.metaKey || e.ctrlKey) && e.key === 'a') {
787-
e.preventDefault()
788-
const rws = rowsRef.current
789-
if (rws.length > 0) {
790-
setEditingCell(null)
791-
setSelectionAnchor(null)
792-
setSelectionFocus(null)
793-
const all = new Set<number>()
794-
for (const row of rws) {
795-
all.add(row.position)
796-
}
797-
setCheckedRows(all)
798-
}
799-
return
800-
}
801-
802802
if (['ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight'].includes(e.key)) {
803803
e.preventDefault()
804804
setCheckedRows((prev) => (prev.size === 0 ? prev : EMPTY_CHECKED_ROWS))

0 commit comments

Comments
 (0)