From e25a8b04c90681dddc2f1931a4793a0db4ddbbd1 Mon Sep 17 00:00:00 2001 From: Daisuke Tsuji Date: Sat, 13 Jun 2026 13:09:51 +0900 Subject: [PATCH] fix(input): don't submit on Enter during IME composition Enter pressed to confirm an IME (Japanese/CJK) conversion candidate was being treated as 'send', submitting half-converted text and making the app unusable for IME input. Guard the Enter-to-submit handlers with isComposing (and keyCode 229 as a fallback) across all prompt inputs: TaskInput, AgentPane FollowUpInput, Pill, and LogsApp. --- app/src/renderer/hub/AgentPane.tsx | 2 +- app/src/renderer/hub/TaskInput.tsx | 2 +- app/src/renderer/logs/LogsApp.tsx | 2 +- app/src/renderer/pill/Pill.tsx | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/src/renderer/hub/AgentPane.tsx b/app/src/renderer/hub/AgentPane.tsx index 6f8fed9f..3f90c96a 100644 --- a/app/src/renderer/hub/AgentPane.tsx +++ b/app/src/renderer/hub/AgentPane.tsx @@ -578,7 +578,7 @@ function FollowUpInput({ sessionId, onUserInput, autoFocus }: { sessionId: strin if (e.key === 'Escape') { e.preventDefault(); textareaRef.current?.blur(); - } else if (e.key === 'Enter' && !e.shiftKey) { + } else if (e.key === 'Enter' && !e.shiftKey && !e.nativeEvent.isComposing && e.keyCode !== 229) { e.preventDefault(); handleSubmit(); } diff --git a/app/src/renderer/hub/TaskInput.tsx b/app/src/renderer/hub/TaskInput.tsx index 870ad548..c1e17526 100644 --- a/app/src/renderer/hub/TaskInput.tsx +++ b/app/src/renderer/hub/TaskInput.tsx @@ -203,7 +203,7 @@ export const TaskInput = forwardRef(function Ta const onKeyDown = useCallback( (e: React.KeyboardEvent) => { - if (e.key === 'Enter' && !e.shiftKey) { + if (e.key === 'Enter' && !e.shiftKey && !e.nativeEvent.isComposing && e.keyCode !== 229) { e.preventDefault(); submit(); } else if (e.key === 'Escape') { diff --git a/app/src/renderer/logs/LogsApp.tsx b/app/src/renderer/logs/LogsApp.tsx index 5d71b955..2e1d9fa3 100644 --- a/app/src/renderer/logs/LogsApp.tsx +++ b/app/src/renderer/logs/LogsApp.tsx @@ -342,7 +342,7 @@ export function LogsApp(): React.ReactElement { const onInputKeyDown = useCallback( (e: React.KeyboardEvent) => { - if (e.key === 'Enter' && !e.shiftKey) { + if (e.key === 'Enter' && !e.shiftKey && !e.nativeEvent.isComposing && e.keyCode !== 229) { e.preventDefault(); void sendFollowUp(); } diff --git a/app/src/renderer/pill/Pill.tsx b/app/src/renderer/pill/Pill.tsx index 9606cefa..ae33e09c 100644 --- a/app/src/renderer/pill/Pill.tsx +++ b/app/src/renderer/pill/Pill.tsx @@ -423,7 +423,7 @@ export function Pill(): React.ReactElement { setAttachments([]); setAttachError(null); } - } else if (e.key === 'Enter' && !e.shiftKey) { + } else if (e.key === 'Enter' && !e.shiftKey && !e.nativeEvent.isComposing && e.keyCode !== 229) { e.preventDefault(); submit(); }