mirror of https://github.com/langgenius/dify.git
fix: prevent Enter key from triggering submit during IME composition
Add isComposing check at the start of handleKeyDown to ignore keyboard events during IME (Chinese/Japanese/Korean) input composition. This follows the existing pattern used in tag-management component and prevents premature form submission when users press Enter to confirm IME candidates.
This commit is contained in:
parent
c571185a91
commit
3344723393
|
|
@ -432,6 +432,10 @@ const MentionInputInner = forwardRef<HTMLTextAreaElement, MentionInputProps>(({
|
|||
}, [value, mentionedUserIds, onSubmit])
|
||||
|
||||
const handleKeyDown = useCallback((e: React.KeyboardEvent) => {
|
||||
// Ignore key events during IME composition (e.g., Chinese, Japanese input)
|
||||
if (e.nativeEvent.isComposing)
|
||||
return
|
||||
|
||||
if (showMentionDropdown) {
|
||||
if (e.key === 'ArrowDown') {
|
||||
e.preventDefault()
|
||||
|
|
|
|||
Loading…
Reference in New Issue