fix(bubble-input): ignore enter key when composing

This commit is contained in:
Takuya Matsuyama 2022-06-07 15:29:04 +09:00
parent fa4a783698
commit bddf2257fe

View file

@ -6,7 +6,8 @@ const BubbleInput = ({ onChange, onSubmit, value }) => {
const [submitted, setSubmitted] = useState(false) const [submitted, setSubmitted] = useState(false)
const handleKeyDown = e => { const handleKeyDown = e => {
if (e.key === 'Enter') { const { isComposing } = e.nativeEvent
if (e.key === 'Enter' && !isComposing) {
onSubmit && onSubmit() onSubmit && onSubmit()
e.preventDefault() e.preventDefault()
setSubmitted(true) setSubmitted(true)