From ce66d753e2619e610e28d3fc02dcb01e2467993e Mon Sep 17 00:00:00 2001 From: anovazzi1 Date: Tue, 20 Jun 2023 20:49:32 -0300 Subject: [PATCH] feat(chatInput): add useEffect hook to focus on chat input when lockChat is false and inputRef is available fix(chatInput): remove unnecessary comment in useEffect hook --- src/frontend/src/modals/chatModal/chatInput/index.tsx | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/frontend/src/modals/chatModal/chatInput/index.tsx b/src/frontend/src/modals/chatModal/chatInput/index.tsx index 03be27cdb..5f02979ca 100644 --- a/src/frontend/src/modals/chatModal/chatInput/index.tsx +++ b/src/frontend/src/modals/chatModal/chatInput/index.tsx @@ -10,6 +10,15 @@ export default function ChatInput({ setChatValue, inputRef, }) { + useEffect(() => { + if (!lockChat && inputRef.current) { + inputRef.current.focus(); + } + },[ + lockChat,inputRef + ]) + + useEffect(() => { if (inputRef.current) { inputRef.current.style.height = "inherit"; // Reset the height