diff --git a/TODO.md b/TODO.md index 64444efc8946c71de355de03f443e6ecddcbd63b..1d33686b467ac80c904e97059e1caf711ecd99fa 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 5def8849f8dc0ab5a25c92aba6f3c55242641fb2..727ce8fb044b7ef2c5ff9a12dd68b0f3ebb758a4 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 3b2382f9474c6a94984bfee21e3daecc7f85a6e0..dc26f95c96d860f83544e95857d689aea4013cb4 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;