Skip to content

Commit

Permalink
Merge pull request janhq#1821 from copyhold/autofocus-text-input-when…
Browse files Browse the repository at this point in the history
…-start-new-chat

Autofocus text input when start new chat
  • Loading branch information
urmauur authored Jan 28, 2024
2 parents 36a8809 + 982b0dc commit 51eeccf
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions web/screens/Chat/ChatInput/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,17 @@ const ChatInput: React.FC = () => {
setIsWaitingToSend(false)
sendChatMessage()
}
if (textareaRef.current) {
textareaRef.current.focus()
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [waitingToSendMessage, activeThreadId])

useEffect(() => {
if (textareaRef.current) {
textareaRef.current.style.height = '40px'
textareaRef.current.style.height = textareaRef.current.scrollHeight + 'px'
textareaRef.current.focus()
}
}, [currentPrompt])

Expand Down

0 comments on commit 51eeccf

Please sign in to comment.