diff --git a/web/src/features/messages/ConversationView.tsx b/web/src/features/messages/ConversationView.tsx index 84492327..9b0a3258 100644 --- a/web/src/features/messages/ConversationView.tsx +++ b/web/src/features/messages/ConversationView.tsx @@ -267,6 +267,15 @@ export function ConversationView() { // eslint-disable-next-line react-hooks/exhaustive-deps }, [topicId]); + // Switching into a chat window should let the user start typing immediately, not require an extra + // click into the input first -- matches every mainstream IM client. Deliberately NOT keyed on + // `messages` (would re-steal focus away from whatever the user is doing every time a new message + // arrives while they're already composing) -- only the initial switch itself should grab focus. + useEffect(() => { + if (!topicId) return; + textareaRef.current?.focus(); + }, [topicId]); + // Someone else dissolving the group currently open here (or this account being removed from it) // fires the SDK's `onDeleteTopic`, not `onData`/`onPres` -- those only invalidate this screen's // cached snapshots for re-render, they don't tell it the topic itself is gone. Left unhandled, the