From 0af3514d9b8ecb752bc9a359f00c00d21ab59db2 Mon Sep 17 00:00:00 2001 From: amosblomqvist Date: Tue, 6 Oct 2026 04:05:38 +0300 Subject: [PATCH] practice: Enter fires next-problem from anywhere, not just composer focus (round 16 refinement 2) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The docks' useEnterSubmits pattern, mounted for the pause in ChatView: window-level Enter (typing surfaces and buttons excluded, so the focused composer/button keep their own lane — no double fire) calls sendNext, which self-guards on nextReady (inert outside the pause; the dock listeners are unmounted by then — the two never overlap). Owner's keyboard-first directive: body focus, a scroll, anywhere. --- components/chat.tsx | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/components/chat.tsx b/components/chat.tsx index 85e3b98..a93a433 100644 --- a/components/chat.tsx +++ b/components/chat.tsx @@ -23,6 +23,7 @@ import { AnsweredCard } from "@/components/answered-card"; import { artifactRenderers } from "@/components/artifacts"; import { SubagentSteerCard } from "@/components/artifacts/steer-card"; import { Composer } from "@/components/composer"; +import { useEnterSubmits } from "@/components/enter-submits"; import { QueuedSteersBody, type QueuedSteerLine } from "@/components/queued-steers"; import { DictationBar, joinDictation, useDictation } from "@/components/dictation"; import { JobsContext } from "@/components/jobs-context"; @@ -656,6 +657,16 @@ export function Chat({ void send({ type: "next" }); }, [nextReady, send]); + /* ENTER FROM ANYWHERE (owner round 16 refinement, 2026-10-06 — + * keyboard-first): the move-on must not require composer focus. The + * window-level Enter (typing surfaces and buttons excluded — a + * focused composer/button keeps its own lane, so no double fire) + * fires the signal from body focus, a scroll, anywhere. sendNext + * self-guards on nextReady, so the listener is inert outside the + * pause — the dock-mounted listeners are gone by then (docks unmount + * when nothing is active; the two never overlap). */ + useEnterSubmits(sendNext); + const syncFromServer = useCallback(async () => { const res = await fetch(`/api/chats/${chatId}`); if (!res.ok) return;