Skip to content

Open-source Grok Bot alternative for named AI teammates. Local-first desktop, web, and mobile clients with per-bot tools, instructions, and memory. Independent fork of T3 Code.

Improve thread composer focus behavior

Theo Browne54e7dd96f731
diff --git a/TODO.md b/TODO.md
index 64444efc8..1d33686b4 100644
--- a/TODO.md
+++ b/TODO.md
@@ -12,3 +12,5 @@
- [x] Reduce noise of tool calls (combine "command run" and "command completed", make tool calls a "box" with limited # of calls shown at a time, etc)
- [ ] Insta focus input on new thread creation
- [ ] Disable "streaming" (wait until whole paragraph/step finishes before showing it
+- [ ] Making new thread should auto-focus input box
+- [ ] Threads should be scrolled to bottom on open (they currently start near top and "scroll down" after rendering, it's jank)
diff --git a/apps/web/src/components/ChatView.tsx b/apps/web/src/components/ChatView.tsx
index 5def8849f..727ce8fb0 100644
--- a/apps/web/src/components/ChatView.tsx
+++ b/apps/web/src/components/ChatView.tsx
@@ -357,6 +357,16 @@ export default function ChatView() {
setExpandedWorkGroups({});
}, [activeThread?.id]);
+ useEffect(() => {
+ if (!activeThread?.id || activeThread.terminalOpen) return;
+ const frame = window.requestAnimationFrame(() => {
+ focusComposer();
+ });
+ return () => {
+ window.cancelAnimationFrame(frame);
+ };
+ }, [activeThread?.id, activeThread?.terminalOpen, focusComposer]);
+
useEffect(() => {
composerImagesRef.current = composerImages;
}, [composerImages]);
diff --git a/apps/web/src/components/Sidebar.tsx b/apps/web/src/components/Sidebar.tsx
index 3b2382f94..dc26f95c9 100644
--- a/apps/web/src/components/Sidebar.tsx
+++ b/apps/web/src/components/Sidebar.tsx
@@ -328,19 +328,6 @@ export default function Sidebar() {
event.key.toLowerCase() === "o";
if (!isNewThreadShortcut) return;
- const target = event.target;
- if (target instanceof HTMLElement) {
- const tagName = target.tagName;
- if (
- target.isContentEditable ||
- tagName === "INPUT" ||
- tagName === "TEXTAREA" ||
- tagName === "SELECT"
- ) {
- return;
- }
- }
-
const activeThread = state.threads.find((t) => t.id === state.activeThreadId);
const projectId = activeThread?.projectId ?? state.projects[0]?.id;
if (!projectId) return;