From 80c15a534dfe99b08b26b219922b682ec8e8f5dd Mon Sep 17 00:00:00 2001 From: nogataka Date: Wed, 28 Jan 2026 12:59:14 +0900 Subject: [PATCH] fix: Prevent accidental message submission during IME composition Add isComposing check to prevent Enter key from submitting messages while Japanese (or other) IME input is in progress. Affected components: - AssistantChat - ExpandProjectChat - SpecCreationChat - FolderBrowser - TerminalTabs --- ui/src/components/AssistantChat.tsx | 3 ++- ui/src/components/ExpandProjectChat.tsx | 3 ++- ui/src/components/FolderBrowser.tsx | 3 ++- ui/src/components/SpecCreationChat.tsx | 3 ++- ui/src/components/TerminalTabs.tsx | 3 ++- 5 files changed, 10 insertions(+), 5 deletions(-) diff --git a/ui/src/components/AssistantChat.tsx b/ui/src/components/AssistantChat.tsx index 8f438a1..a2d7ba8 100644 --- a/ui/src/components/AssistantChat.tsx +++ b/ui/src/components/AssistantChat.tsx @@ -134,7 +134,8 @@ export function AssistantChat({ } const handleKeyDown = (e: React.KeyboardEvent) => { - if (e.key === 'Enter' && !e.shiftKey) { + // Skip if composing (e.g., Japanese IME input) + if (e.key === 'Enter' && !e.shiftKey && !e.nativeEvent.isComposing) { e.preventDefault() handleSend() } diff --git a/ui/src/components/ExpandProjectChat.tsx b/ui/src/components/ExpandProjectChat.tsx index 52926cb..2eb30b3 100644 --- a/ui/src/components/ExpandProjectChat.tsx +++ b/ui/src/components/ExpandProjectChat.tsx @@ -88,7 +88,8 @@ export function ExpandProjectChat({ } const handleKeyDown = (e: React.KeyboardEvent) => { - if (e.key === 'Enter' && !e.shiftKey) { + // Skip if composing (e.g., Japanese IME input) + if (e.key === 'Enter' && !e.shiftKey && !e.nativeEvent.isComposing) { e.preventDefault() handleSendMessage() } diff --git a/ui/src/components/FolderBrowser.tsx b/ui/src/components/FolderBrowser.tsx index c3e998a..8641bdd 100644 --- a/ui/src/components/FolderBrowser.tsx +++ b/ui/src/components/FolderBrowser.tsx @@ -269,7 +269,8 @@ export function FolderBrowser({ onSelect, onCancel, initialPath }: FolderBrowser className="flex-1" autoFocus onKeyDown={(e) => { - if (e.key === 'Enter') handleCreateFolder() + // Skip if composing (e.g., Japanese IME input) + if (e.key === 'Enter' && !e.nativeEvent.isComposing) handleCreateFolder() if (e.key === 'Escape') { setIsCreatingFolder(false) setNewFolderName('') diff --git a/ui/src/components/SpecCreationChat.tsx b/ui/src/components/SpecCreationChat.tsx index 1aa804a..24d0c09 100644 --- a/ui/src/components/SpecCreationChat.tsx +++ b/ui/src/components/SpecCreationChat.tsx @@ -127,7 +127,8 @@ export function SpecCreationChat({ } const handleKeyDown = (e: React.KeyboardEvent) => { - if (e.key === 'Enter' && !e.shiftKey) { + // Skip if composing (e.g., Japanese IME input) + if (e.key === 'Enter' && !e.shiftKey && !e.nativeEvent.isComposing) { e.preventDefault() handleSendMessage() } diff --git a/ui/src/components/TerminalTabs.tsx b/ui/src/components/TerminalTabs.tsx index 2771dec..760d69d 100644 --- a/ui/src/components/TerminalTabs.tsx +++ b/ui/src/components/TerminalTabs.tsx @@ -96,7 +96,8 @@ export function TerminalTabs({ // Handle key events during editing const handleKeyDown = useCallback( (e: React.KeyboardEvent) => { - if (e.key === 'Enter') { + // Skip if composing (e.g., Japanese IME input) + if (e.key === 'Enter' && !e.nativeEvent.isComposing) { e.preventDefault() submitEdit() } else if (e.key === 'Escape') {