Add keyboard navigation: e/c/slash shortcuts, j/k list nav, focus visibility

- App.vue: e → edit on viewer pages; / → focus search (custom event); c → focus
  chat on home or navigate to /chat; update shortcuts panel with Lists + Chat sections
- theme.css: add a:focus-visible to focus-ring rules (router-link cards now show
  visible keyboard focus outline)
- SearchBar.vue: expose focus() via defineExpose for cross-component focus dispatch
- NotesListView / TasksListView: j/k vim-style navigation with kb-active-item
  highlight; listen for shortcut:focus-search; cleanup on unmount
- HomeView.vue: listen for shortcut:focus-chat, call chatInputRef.focus()

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-04 08:39:49 -05:00
parent 264c3664ba
commit 969ef0efa3
6 changed files with 174 additions and 25 deletions
+43
View File
@@ -95,6 +95,24 @@ function onGlobalKeydown(e: KeyboardEvent) {
case "t":
router.push("/tasks/new");
break;
case "e": {
const name = router.currentRoute.value.name;
if (name === "note-view" || name === "task-view") {
router.push(router.currentRoute.value.path + "/edit");
}
break;
}
case "/":
e.preventDefault();
document.dispatchEvent(new CustomEvent("shortcut:focus-search"));
break;
case "c":
if (router.currentRoute.value.name === "home") {
document.dispatchEvent(new CustomEvent("shortcut:focus-chat"));
} else {
router.push("/chat");
}
break;
}
}
@@ -193,8 +211,33 @@ onUnmounted(() => {
<span class="shortcut-desc">New task</span>
</div>
</div>
<div class="shortcuts-section">
<div class="shortcuts-section-title">Lists</div>
<div class="shortcut-row">
<kbd class="shortcut-key">/</kbd>
<span class="shortcut-desc">Focus search bar</span>
</div>
<div class="shortcut-row">
<kbd class="shortcut-key">j</kbd>
<span class="shortcut-key-sep">/</span>
<kbd class="shortcut-key">k</kbd>
<span class="shortcut-desc">Move down / up</span>
</div>
<div class="shortcut-row">
<kbd class="shortcut-key">Enter</kbd>
<span class="shortcut-desc">Open selected item</span>
</div>
<div class="shortcut-row">
<kbd class="shortcut-key">e</kbd>
<span class="shortcut-desc">Edit current item (viewer)</span>
</div>
</div>
<div class="shortcuts-section">
<div class="shortcuts-section-title">Chat</div>
<div class="shortcut-row">
<kbd class="shortcut-key">c</kbd>
<span class="shortcut-desc">Focus chat (home) / go to chat</span>
</div>
<div class="shortcut-row">
<kbd class="shortcut-key">Enter</kbd>
<span class="shortcut-desc">Send message</span>