Skip to content

armgit / alook

Public Imported from GitHub
0

Multi-Agent Collaboration for Team and Friends

fix(community): focus composer when a reply is initiated

Gus54dde56d0010
diff --git a/src/web/src/components/community/composer.tsx b/src/web/src/components/community/composer.tsx
index 0d74eac81..69df9e8ba 100644
--- a/src/web/src/components/community/composer.tsx
+++ b/src/web/src/components/community/composer.tsx
@@ -429,6 +429,20 @@ export const Composer = forwardRef<ComposerHandle, ComposerProps>(function Compo
editor.commands.focus("end")
}, [autoFocus, editor, channel, isForumPostBody])
+ // Focus the editor when a reply is initiated. Clicking "reply" on a message
+ // sets `replyingTo` on the parent but doesn't touch the composer, so without
+ // this the reply bar appears while focus stays on the message list — the user
+ // has to click into the input before typing. Fire only on the unset→set edge
+ // (clicking reply), not while a reply is already active or on cancel. Focus
+ // regardless of `autoFocus`: reply is an explicit user action, so popping the
+ // mobile keyboard is intended (same rationale as the drop handler below).
+ const prevReplyingToRef = useRef(replyingTo)
+ useEffect(() => {
+ const opened = !prevReplyingToRef.current && !!replyingTo
+ prevReplyingToRef.current = replyingTo
+ if (opened && editor && !isForumPostBody) editor.commands.focus("end")
+ }, [replyingTo, editor, isForumPostBody])
+
// Refocus editor after a drop so the user can start typing without
// clicking. The drop landed on the composer container — the intent is
// clear.