fix: correct chat input cursor behavior when content is scrollable (#3979)

This commit is contained in:
Faisal Amir 2024-11-08 16:32:42 +07:00 committed by GitHub
parent 387f140ba8
commit ebad6c3e93
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -269,6 +269,10 @@ const RichTextEditor = ({
? '100px' ? '100px'
: '40px' : '40px'
textareaRef.current.style.height = textareaRef.current.scrollHeight + 'px' textareaRef.current.style.height = textareaRef.current.scrollHeight + 'px'
textareaRef.current?.scrollTo({
top: textareaRef.current.scrollHeight,
behavior: 'instant',
})
textareaRef.current.style.overflow = textareaRef.current.style.overflow =
textareaRef.current.clientHeight >= 390 ? 'auto' : 'hidden' textareaRef.current.clientHeight >= 390 ? 'auto' : 'hidden'
} }