mirror of
https://github.com/OpenHands/OpenHands.git
synced 2026-03-22 05:37:20 +08:00
Fix: Prevent Enter key from submitting during IME composition (#12252)
Co-authored-by: openhands <openhands@all-hands.dev>
This commit is contained in:
@@ -30,6 +30,10 @@ export function ConversationCardTitle({
|
||||
onSave(trimmed);
|
||||
}}
|
||||
onKeyUp={(event: React.KeyboardEvent<HTMLInputElement>) => {
|
||||
// Ignore Enter key during IME composition (e.g., Chinese, Japanese, Korean input)
|
||||
if (event.nativeEvent.isComposing) {
|
||||
return;
|
||||
}
|
||||
if (event.key === "Enter") {
|
||||
event.currentTarget.blur();
|
||||
}
|
||||
|
||||
@@ -91,6 +91,10 @@ export function ConversationName() {
|
||||
};
|
||||
|
||||
const handleKeyUp = (event: React.KeyboardEvent<HTMLInputElement>) => {
|
||||
// Ignore Enter key during IME composition (e.g., Chinese, Japanese, Korean input)
|
||||
if (event.nativeEvent.isComposing) {
|
||||
return;
|
||||
}
|
||||
if (event.key === "Enter") {
|
||||
event.currentTarget.blur();
|
||||
}
|
||||
|
||||
@@ -68,6 +68,12 @@ export const useChatInputEvents = (
|
||||
return;
|
||||
}
|
||||
|
||||
// Ignore Enter key during IME composition (e.g., Chinese, Japanese, Korean input)
|
||||
// When using IME, Enter is used to confirm the composition, not to submit
|
||||
if (e.nativeEvent.isComposing) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (checkIsContentEmpty()) {
|
||||
e.preventDefault();
|
||||
increaseHeightForEmptyContent();
|
||||
|
||||
Reference in New Issue
Block a user