Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
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>
  • Loading branch information
waleedlatif1 and claude committed Mar 17, 2026
commit 29c765c56155fc7b2291e655360e286ef2421815
Original file line number Diff line number Diff line change
Expand Up @@ -693,13 +693,6 @@ export function Table({
return
}

const anchor = selectionAnchorRef.current
if (!anchor || editingCellRef.current) return

const cols = columnsRef.current
const mp = maxPositionRef.current
const totalRows = mp + 1

if (e.key === 'Escape') {
e.preventDefault()
setSelectionAnchor(null)
Expand All @@ -709,6 +702,29 @@ export function Table({
return
}

if ((e.metaKey || e.ctrlKey) && e.key === 'a') {
e.preventDefault()
const rws = rowsRef.current
if (rws.length > 0) {
setEditingCell(null)
setSelectionAnchor(null)
setSelectionFocus(null)
const all = new Set<number>()
for (const row of rws) {
all.add(row.position)
}
setCheckedRows(all)
}
return
}

const anchor = selectionAnchorRef.current
if (!anchor || editingCellRef.current) return

const cols = columnsRef.current
const mp = maxPositionRef.current
const totalRows = mp + 1

if (e.shiftKey && e.key === 'Enter') {
const row = positionMapRef.current.get(anchor.rowIndex)
if (!row) return
Expand Down Expand Up @@ -783,22 +799,6 @@ export function Table({
return
}

if ((e.metaKey || e.ctrlKey) && e.key === 'a') {
e.preventDefault()
const rws = rowsRef.current
if (rws.length > 0) {
setEditingCell(null)
setSelectionAnchor(null)
setSelectionFocus(null)
const all = new Set<number>()
for (const row of rws) {
all.add(row.position)
}
setCheckedRows(all)
}
return
}

if (['ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight'].includes(e.key)) {
e.preventDefault()
setCheckedRows((prev) => (prev.size === 0 ? prev : EMPTY_CHECKED_ROWS))
Expand Down
Loading