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

Check event.nativeEvent.isComposing in Enter-to-submit branches so CJK (Japanese, Chinese, Korean) and other compositional input methods commit the candidate instead of firing the send handler.

Applied to all five sites in the desktop renderer that currently handle Enter with no composition guard:

- chat composer main submit and trigger popover (apps/desktop/src/app/chat/composer/index.tsx)
- message edit composer submit and trigger popover (apps/desktop/src/components/assistant-ui/thread.tsx)
- onboarding API key and auth code inputs (apps/desktop/src/components/desktop-onboarding-overlay.tsx)
- session rename input (apps/desktop/src/app/chat/sidebar/session-actions-menu.tsx)

Fixes #37483
This commit is contained in:
Takumi Sato
2026-06-03 00:59:36 +09:00
committed by Teknium
parent 6fb6123f3b
commit 20beee774c
3 changed files with 4 additions and 4 deletions
@@ -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') {
@@ -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}
/>
@@ -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}