Skip to content

The agent that grows with you

fix(desktop): prevent Enter from submitting during IME composition

Takumi Sato20beee774cc4
diff --git a/apps/desktop/src/app/chat/sidebar/session-actions-menu.tsx b/apps/desktop/src/app/chat/sidebar/session-actions-menu.tsx
index 3a9e5b8c10c..5fc32e6c3b7 100644
--- a/apps/desktop/src/app/chat/sidebar/session-actions-menu.tsx
+++ b/apps/desktop/src/app/chat/sidebar/session-actions-menu.tsx
@@ -652,7 +652,7 @@ function RenameSessionDialog({ open, onOpenChange, sessionId, currentTitle, prof
disabled={submitting}
onChange={event => setValue(event.target.value)}
onKeyDown={event => {
- if (event.key === 'Enter') {
+ if (event.key === 'Enter' && !event.nativeEvent.isComposing) {
event.preventDefault()
void submit()
} else if (event.key === 'Escape') {
diff --git a/apps/desktop/src/components/onboarding/flow.tsx b/apps/desktop/src/components/onboarding/flow.tsx
index c81419fc847..dc4b16a54a7 100644
--- a/apps/desktop/src/components/onboarding/flow.tsx
+++ b/apps/desktop/src/components/onboarding/flow.tsx
@@ -82,7 +82,7 @@ export function FlowPanel({
<Input
autoFocus
onChange={e => setOnboardingCode(e.target.value)}
- onKeyDown={e => e.key === 'Enter' && void submitOnboardingCode(ctx)}
+ onKeyDown={e => e.key === 'Enter' && !e.nativeEvent.isComposing && void submitOnboardingCode(ctx)}
placeholder={t.onboarding.pasteAuthCode}
value={flow.code}
/>
diff --git a/apps/desktop/src/components/onboarding/index.tsx b/apps/desktop/src/components/onboarding/index.tsx
index 3b44c4cba05..e75d1280009 100644
--- a/apps/desktop/src/components/onboarding/index.tsx
+++ b/apps/desktop/src/components/onboarding/index.tsx
@@ -662,7 +662,7 @@ export function ApiKeyForm({
autoFocus
className="font-mono"
onChange={e => setValue(e.target.value)}
- onKeyDown={e => e.key === 'Enter' && void submit()}
+ onKeyDown={e => e.key === 'Enter' && !e.nativeEvent.isComposing && void submit()}
placeholder={
currentRedacted ??
(alreadySet ? t.onboarding.replaceCurrent : option.placeholder || t.onboarding.pasteApiKey)
@@ -675,7 +675,7 @@ export function ApiKeyForm({
autoComplete="off"
className="font-mono"
onChange={e => setLocalKey(e.target.value)}
- onKeyDown={e => e.key === 'Enter' && void submit()}
+ onKeyDown={e => e.key === 'Enter' && !e.nativeEvent.isComposing && void submit()}
placeholder={t.onboarding.localApiKeyPlaceholder}
type="password"
value={localKey}