feat: keyboard waves A/B — global shortcut registry, question row machine, Esc-cancel dictation
Wave A (owner key map): registry in src/core/keyboard.ts + KeyboardShortcuts
provider; Cmd+D dictation, Cmd+K model picker, Shift+Tab thinking cycle,
Cmd+B sidebar, Cmd+Shift+F sessions search, Alt+arrows session cycle,
Alt+Enter open, Cmd+G graph, Cmd+N new, F2 rename, ? cheat sheet. Tab
fully suppressed; Esc chain popover > dictation > abort (local stream).
Esc now CANCELS dictation (discard) — flush stays on Cmd+D/Stop. Owner
bug reports fixed: focus outline removed, Alt+Enter setState-in-render,
Cmd+F graph node search (surface-scoped lh:kbd-find).
Wave B: question dock row machine — arrows walk options + dont-know/Other
with wrap + ring highlight, Space picks (mirrors click semantics), Enter
submits when canSubmit; typing surfaces and in-dock keys keep native
behavior. aria-checked={isSel} restored on option buttons.
docs/keyboard.md records the full map.
This commit is contained in:
@@ -345,11 +345,11 @@ function SessionsSidebar() {
|
||||
cycle(1);
|
||||
};
|
||||
const onOpenSelected = () => {
|
||||
setKbdIndex((i) => {
|
||||
const target = i !== null ? shown?.[i] : undefined;
|
||||
if (target) router.push(`/chat/${target.id}`);
|
||||
return target ? null : i;
|
||||
});
|
||||
const target = kbdIndex !== null ? shown?.[kbdIndex] : undefined;
|
||||
if (target) {
|
||||
router.push(`/chat/${target.id}`);
|
||||
setKbdIndex(null);
|
||||
}
|
||||
};
|
||||
window.addEventListener("lh:kbd-cycle-session-prev", onPrev);
|
||||
window.addEventListener("lh:kbd-cycle-session-next", onNext);
|
||||
@@ -359,7 +359,9 @@ function SessionsSidebar() {
|
||||
window.removeEventListener("lh:kbd-cycle-session-next", onNext);
|
||||
window.removeEventListener("lh:kbd-open-session", onOpenSelected);
|
||||
};
|
||||
}, [open, toggle, shown, router]);
|
||||
// kbdIndex is read (not upserted) so Alt+Enter pushes OUTSIDE any
|
||||
// state updater — a router.push inside one is setState-in-render.
|
||||
}, [open, toggle, shown, router, kbdIndex]);
|
||||
|
||||
// Keep the kbd-selected row in view (the rows are the container's only
|
||||
// buttons, so the index matches).
|
||||
|
||||
Reference in New Issue
Block a user