diff --git a/CLAUDE.md b/CLAUDE.md index 89dc3af..a619c4f 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -347,7 +347,8 @@ Two independent apps that talk over HTTP: devices. TanStack Table + **virtualized** grid; per-row play button, configurable columns, header sorting, inline double-click editing, and **Finder-style row selection** — click / Cmd-Ctrl+click / Shift+click over - the SORTED rows, ↑/↓ (Shift extends), Cmd/Ctrl+A, Esc; shortcuts stand down + the SORTED rows, ↑/↓ (Shift extends), Cmd/Ctrl+A, Esc, Enter (load + play + the highlighted row, winning over a focused button); shortcuts stand down while an `aria-modal` dialog or `role="menu"` is open, so new dialogs need `aria-modal="true"`. Right-click acts on the whole selection; single-track items are hidden for a multi-selection. A view with a manual order passes diff --git a/frontend/src/components/TrackTable.tsx b/frontend/src/components/TrackTable.tsx index b0b8458..2e60fbe 100644 --- a/frontend/src/components/TrackTable.tsx +++ b/frontend/src/components/TrackTable.tsx @@ -451,7 +451,8 @@ export function TrackTable({ // Keyboard: ↑/↓ move the selection (Shift extends it), Cmd/Ctrl+A selects // every visible row, Esc clears, Delete/Backspace removes (where the view - // allows it). Read through a ref so the listener is attached once. + // allows it), Enter loads the highlighted row into the deck and plays it. + // Read through a ref so the listener is attached once. // ←/→, Space, C and digits belong to the deck (PrepStrip). const keysRef = useRef<(e: KeyboardEvent) => void>(() => {}) keysRef.current = (e) => { @@ -476,6 +477,17 @@ export function TrackTable({ selection.onChange(new Set()) return } + if (e.key === 'Enter' && onPlay) { + // The highlighted row is the lead — the one last clicked or arrowed to, + // which in a multi-selection is the row the cursor is on. + const lead = indexOf(leadRef.current) + if (lead < 0 || !selection.selected.has(rows[lead].original.id)) return + // Wins over a focused button, as Space does for the deck: after clicking + // a playlist and arrowing down, Enter must not re-press that playlist. + e.preventDefault() + if (!e.repeat) onPlay(rows[lead].original) + return + } if (e.key !== 'ArrowUp' && e.key !== 'ArrowDown') return e.preventDefault() const lead = indexOf(leadRef.current)