Skip to content

Commit b21ef93

Browse files
committed
fix: prevent Enter key submit during IME composition
Made-with: Cursor
1 parent 03faba1 commit b21ef93

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

frontend/components/chat-panel.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,12 +118,11 @@ export function ChatPanel({
118118
}, [input, disabled, onSendMessage])
119119

120120
const handleKeyDown = useCallback((e: React.KeyboardEvent) => {
121-
// Enter or Cmd+Enter to send
121+
if (e.nativeEvent.isComposing) return
122122
if (e.key === "Enter" && !e.shiftKey) {
123123
e.preventDefault()
124124
handleSubmit()
125125
}
126-
// Cmd/Ctrl+Enter to send (alternative)
127126
if (e.key === "Enter" && (e.metaKey || e.ctrlKey)) {
128127
e.preventDefault()
129128
handleSubmit()

frontend/components/chat/message-clarification.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ export function MessageClarification({
8181
value={inputValue}
8282
onChange={(e) => setInputValue(e.target.value)}
8383
onKeyDown={(e) => {
84-
if (e.key === "Enter") {
84+
if (e.key === "Enter" && !e.nativeEvent.isComposing) {
8585
handleSubmit()
8686
}
8787
}}

0 commit comments

Comments
 (0)