Merge pull request #1821 from copyhold/autofocus-text-input-when-start-new-chat

Autofocus text input when start new chat
This commit is contained in:
Faisal Amir 2024-01-28 21:46:39 +07:00 committed by GitHub
commit 51eeccfcde
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -66,6 +66,9 @@ const ChatInput: React.FC = () => {
setIsWaitingToSend(false)
sendChatMessage()
}
if (textareaRef.current) {
textareaRef.current.focus()
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [waitingToSendMessage, activeThreadId])
@ -73,6 +76,7 @@ const ChatInput: React.FC = () => {
if (textareaRef.current) {
textareaRef.current.style.height = '40px'
textareaRef.current.style.height = textareaRef.current.scrollHeight + 'px'
textareaRef.current.focus()
}
}, [currentPrompt])