Skip to content

Self-hosted MCP server + dashboard giving Claude Code, Cursor & Hermes agents shared long-term memory over a git-backed markdown vault. Agent-native, Obsidian-compatible second brain — markdown RAG, no vector DB.

feat(a11y): keyboard navigation in the home + activity sections

Ronalds Palacisf03870279de4
diff --git a/app/(app)/activity/page.tsx b/app/(app)/activity/page.tsx
index 067bc8f..263694e 100644
--- a/app/(app)/activity/page.tsx
+++ b/app/(app)/activity/page.tsx
@@ -17,7 +17,7 @@ export default function ActivityPage() {
<p className="mt-2 text-sm text-muted-foreground">
What agents and teammates have done to your brain, straight from the vault&apos;s git history.
</p>
- <div className="mt-8">
+ <div className="mt-8" data-arrow-nav>
{isLoading && !data ? (
<p className="text-sm text-muted-foreground">Loading…</p>
) : (
diff --git a/app/(app)/layout.tsx b/app/(app)/layout.tsx
index 69ff275..e6382fd 100644
--- a/app/(app)/layout.tsx
+++ b/app/(app)/layout.tsx
@@ -3,8 +3,10 @@
import { ActivityBar } from "@/components/activity-bar";
import { Sidebar } from "@/components/sidebar";
import { CommandPalette } from "@/components/command-palette";
+import { useArrowNav } from "@/lib/use-arrow-nav";
export default function AppLayout({ children }: { children: React.ReactNode }) {
+ useArrowNav();
return (
<div className="flex h-dvh overflow-hidden">
<ActivityBar />
diff --git a/app/(app)/page.tsx b/app/(app)/page.tsx
index 619b660..c5e0840 100644
--- a/app/(app)/page.tsx
+++ b/app/(app)/page.tsx
@@ -1,10 +1,12 @@
"use client";
import Link from "next/link";
+import { useRouter } from "next/navigation";
import useSWR, { useSWRConfig } from "swr";
import { useEffect, useRef, useState } from "react";
import { ArrowRight, Brain, Check, GitBranch, Plug, Search, Settings as SettingsIcon } from "lucide-react";
import { fetcher, folderColor } from "@/lib/client";
+import { navItemClass } from "@/lib/use-arrow-nav";
import { CuratorChat } from "@/components/curator-chat";
import { ActivityList, type ActivityEntry } from "@/components/activity-list";
import { RecentNotes } from "@/components/recent-notes";
@@ -90,6 +92,7 @@ function TogglePillar(props: { icon: React.ReactNode; title: string; desc: strin
}
export default function Home() {
+ const router = useRouter();
const { mutate } = useSWRConfig();
const { data: repos } = useSWR<{ repos: Repo[]; active: Repo | null }>("/api/repos", fetcher);
const { data: feat } = useSWR<{ harness?: boolean; mcpAuthRequired?: boolean; appName?: string }>("/api/features", fetcher);
@@ -116,6 +119,22 @@ export default function Home() {
const [results, setResults] = useState<Hit[]>([]);
const [searching, setSearching] = useState(false);
const searchSeq = useRef(0);
+ const searchRef = useRef<HTMLInputElement>(null);
+
+ // "/" focuses the home search (when not already typing somewhere).
+ useEffect(() => {
+ const onKey = (e: KeyboardEvent) => {
+ if (e.key !== "/" || e.metaKey || e.ctrlKey || e.altKey) return;
+ const a = document.activeElement as HTMLElement | null;
+ if (a && (a.tagName === "INPUT" || a.tagName === "TEXTAREA" || a.isContentEditable)) return;
+ if (searchRef.current) {
+ e.preventDefault();
+ searchRef.current.focus();
+ }
+ };
+ document.addEventListener("keydown", onKey);
+ return () => document.removeEventListener("keydown", onKey);
+ }, []);
useEffect(() => {
const query = q.trim();
if (!query) {
@@ -249,12 +268,20 @@ export default function Home() {
<CuratorChat />
) : (
<div className="scrollbar-none h-full overflow-y-auto">
- <div className="mx-auto max-w-2xl px-8 py-10">
+ <div data-arrow-nav className="mx-auto max-w-2xl px-8 py-10">
<div className="relative">
<Search size={15} className="pointer-events-none absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground" />
<Input
+ ref={searchRef}
value={q}
onChange={(e) => setQ(e.target.value)}
+ onKeyDown={(e) => {
+ if (e.key === "Enter" && results.length > 0) {
+ e.preventDefault();
+ router.push(`/n/${results[0].path}`);
+ }
+ }}
+ data-nav-item
placeholder="Search your brain…"
className="h-11 pl-9 text-sm"
aria-label="Search your brain"
@@ -269,7 +296,7 @@ export default function Home() {
<ul className="divide-y divide-border">
{results.slice(0, 10).map((r) => (
<li key={r.path}>
- <Link href={`/n/${r.path}`} className="flex items-center gap-2.5 px-3 py-2 transition-colors hover:bg-accent/60">
+ <Link href={`/n/${r.path}`} data-nav-item className={`flex items-center gap-2.5 px-3 py-2 transition-colors hover:bg-accent/60 ${navItemClass}`}>
<span className="size-1.5 shrink-0 rounded-full" style={{ background: folderColor(r.folder) }} />
<span className="truncate text-sm">{r.title}</span>
<span className="ml-auto max-w-[45%] shrink-0 truncate font-mono text-xs text-muted-foreground">{r.path}</span>
@@ -293,6 +320,12 @@ export default function Home() {
<ActivityList entries={recent} />
</section>
)}
+ <p className="text-center text-[11px] text-muted-foreground/70">
+ <kbd className="rounded border border-border px-1 font-mono">/</kbd> search ·{" "}
+ <kbd className="rounded border border-border px-1 font-mono">↑</kbd>
+ <kbd className="rounded border border-border px-1 font-mono">↓</kbd> navigate ·{" "}
+ <kbd className="rounded border border-border px-1 font-mono">↵</kbd> open
+ </p>
</div>
)}
</div>
diff --git a/components/activity-list.tsx b/components/activity-list.tsx
index d0246da..141acbc 100644
--- a/components/activity-list.tsx
+++ b/components/activity-list.tsx
@@ -4,6 +4,7 @@ import { useState } from "react";
import Link from "next/link";
import { ChevronRight, FileText, GitCommit } from "lucide-react";
import { timeAgo } from "@/lib/utils";
+import { navItemClass } from "@/lib/use-arrow-nav";
export interface ActivityEntry {
hash: string;
@@ -166,7 +167,7 @@ export function ActivityList({ entries, empty }: { entries: ActivityEntry[]; emp
const detail = details[e.hash];
return (
<li key={`${e.hash}-${i}`} className="py-2.5">
- <button onClick={() => toggle(e.hash)} className="group flex w-full items-start gap-3 text-left">
+ <button onClick={() => toggle(e.hash)} data-nav-item className={`group flex w-full items-start gap-3 rounded-md text-left ${navItemClass}`}>
<span className="mt-0.5 shrink-0 text-muted-foreground">
<GitCommit size={15} className={isOpen ? "hidden" : "block"} />
<ChevronRight size={15} className={isOpen ? "block rotate-90 transition-transform" : "hidden"} />
diff --git a/components/recent-notes.tsx b/components/recent-notes.tsx
index fb23768..7b75857 100644
--- a/components/recent-notes.tsx
+++ b/components/recent-notes.tsx
@@ -4,6 +4,7 @@ import Link from "next/link";
import useSWR from "swr";
import { fetcher, folderColor } from "@/lib/client";
import { useRecents } from "@/lib/recents";
+import { navItemClass } from "@/lib/use-arrow-nav";
/** "Jump back in" — the notes you viewed most recently (from localStorage). Renders nothing when empty. */
export function RecentNotes({ heading = "Jump back in", limit = 6 }: { heading?: string; limit?: number }) {
@@ -24,7 +25,8 @@ export function RecentNotes({ heading = "Jump back in", limit = 6 }: { heading?:
<Link
key={r.path}
href={`/n/${r.path}`}
- className="flex items-center gap-2.5 rounded-lg border border-border bg-card px-3 py-2 transition-colors hover:border-ring"
+ data-nav-item
+ className={`flex items-center gap-2.5 rounded-lg border border-border bg-card px-3 py-2 transition-colors hover:border-ring ${navItemClass}`}
>
<span className="size-1.5 shrink-0 rounded-full" style={{ background: folderColor(folder) }} />
<span className="min-w-0 flex-1">
diff --git a/lib/use-arrow-nav.ts b/lib/use-arrow-nav.ts
new file mode 100644
index 0000000..703c478
--- /dev/null
+++ b/lib/use-arrow-nav.ts
@@ -0,0 +1,59 @@
+"use client";
+
+import { useEffect } from "react";
+
+/**
+ * Shared focus ring for keyboard-navigable items. Applied alongside `data-nav-item`.
+ * focus-visible so a mouse click doesn't light it up, only keyboard focus.
+ */
+export const navItemClass = "outline-none focus-visible:ring-2 focus-visible:ring-ring/70";
+
+/**
+ * App-wide arrow-key navigation, opt-in per section. Call once (in the app layout); it adds a
+ * single document listener. It only acts when focus is inside an element marked
+ * `[data-arrow-nav]`, moving focus between that section's `[data-nav-item]` elements:
+ * ↑/↓ move up/down (also works from a single-line search input → into the list)
+ * Home/End jump to first/last (skipped while typing in an input)
+ * j/k vim down/up (skipped while typing in an input)
+ * Enter is left to the item itself (links navigate, buttons toggle). Multi-line editors
+ * (textarea / contenteditable) are never hijacked.
+ */
+export function useArrowNav() {
+ useEffect(() => {
+ const onKey = (e: KeyboardEvent) => {
+ if (e.metaKey || e.ctrlKey || e.altKey || e.shiftKey) return;
+ const active = document.activeElement as HTMLElement | null;
+ if (!active) return;
+ if (active.tagName === "TEXTAREA" || active.isContentEditable) return; // leave editors alone
+ const inInput = active.tagName === "INPUT";
+
+ let dir: 1 | -1 | "first" | "last" | null = null;
+ if (e.key === "ArrowDown") dir = 1;
+ else if (e.key === "ArrowUp") dir = -1;
+ else if (!inInput && e.key === "Home") dir = "first";
+ else if (!inInput && e.key === "End") dir = "last";
+ else if (!inInput && e.key === "j") dir = 1;
+ else if (!inInput && e.key === "k") dir = -1;
+ if (dir === null) return;
+
+ const container = active.closest<HTMLElement>("[data-arrow-nav]");
+ if (!container) return;
+ const items = Array.from(container.querySelectorAll<HTMLElement>("[data-nav-item]")).filter(
+ (n) => n.offsetParent !== null || n === active,
+ );
+ if (items.length === 0) return;
+
+ const idx = items.indexOf(active);
+ let next: number;
+ if (dir === "first") next = 0;
+ else if (dir === "last") next = items.length - 1;
+ else if (dir === 1) next = idx < 0 ? 0 : Math.min(idx + 1, items.length - 1);
+ else next = idx < 0 ? 0 : Math.max(idx - 1, 0);
+
+ e.preventDefault();
+ items[next]?.focus();
+ };
+ document.addEventListener("keydown", onKey);
+ return () => document.removeEventListener("keydown", onKey);
+ }, []);
+}