From 755b2f234b744c1d88b93dea5f62b65cf47d7c53 Mon Sep 17 00:00:00 2001 From: Faisal Amir Date: Mon, 4 Nov 2024 14:57:09 +0700 Subject: [PATCH] ux: auto-focus the chat input box (#3941) * ux: auto-focus the chat input box and search box when switching between pages and thread lists * chore: remove autofocus hub --- .../Thread/ThreadCenterPanel/ChatInput/RichTextEditor.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/web/screens/Thread/ThreadCenterPanel/ChatInput/RichTextEditor.tsx b/web/screens/Thread/ThreadCenterPanel/ChatInput/RichTextEditor.tsx index 88ddad485..87ea4e08f 100644 --- a/web/screens/Thread/ThreadCenterPanel/ChatInput/RichTextEditor.tsx +++ b/web/screens/Thread/ThreadCenterPanel/ChatInput/RichTextEditor.tsx @@ -269,10 +269,13 @@ const RichTextEditor = ({ ) useEffect(() => { + if (!ReactEditor.isFocused(editor)) { + ReactEditor.focus(editor) + } if (textareaRef.current) { textareaRef.current.focus() } - }, [activeThreadId]) + }, [activeThreadId, editor]) useEffect(() => { if (textareaRef.current?.clientHeight) {