fix: suppress Enter submit during IME composition in workflow creation popup#804
Conversation
…popup Pressing Enter during Japanese IME conversion was triggering workflow submission instead of only confirming the candidate. Extract shouldSuppressEnterSubmit() and check event.isComposing before submit in NewWorkspaceComposerModal, NewWorkspacePage, and the task search handler. Fixes stablyai#742.
306a411 to
c5c784c
Compare
|
Hi, this is my first contribution to Orca! I've fixed a bug where pressing Enter to confirm a Japanese IME conversion candidate in the workflow creation popup was also triggering workflow submission. Would love to get your review when you have a chance. Thanks! |
|
Thank you for the thorough fix and the unit tests! The I took the liberty of moving Merging now. Thanks again @fffk10! |
…n popup (stablyai#804) * fix: guard Enter submit against IME composition in workflow creation popup Pressing Enter during Japanese IME conversion was triggering workflow submission instead of only confirming the candidate. Extract shouldSuppressEnterSubmit() and check event.isComposing before submit in NewWorkspaceComposerModal, NewWorkspacePage, and the task search handler. Fixes stablyai#742. * fix: use nativeEvent.isComposing for React SyntheticEvent in task search handler * refactor: move new-workspace-enter-guard to src/renderer/src/lib --------- Co-authored-by: Neil <[email protected]>
Summary
When using a Japanese (or other CJK) IME in the workflow creation popup, pressing Enter to confirm a conversion candidate was also triggering workflow submission. This happened because the Enter key handlers in
NewWorkspaceComposerModalandNewWorkspacePagechecked onlyevent.key === 'Enter'without guarding againstevent.isComposing.This PR extracts a pure helper
shouldSuppressEnterSubmit()innew-workspace-enter-guard.tsand applies it at every submit-on-Enter site:Fixes #742.
Screenshots
before fix
output.mp4
after fix
output.mp4
Testing
pnpm lintpnpm typecheckpnpm testpnpm buildUnit tests added in
new-workspace-enter-guard.test.tscovering:isComposing: true→ suppressedisComposingand Shift+Enter in a textarea → suppressedAI Review Report
Reviewed with Claude Code. Main risks checked:
isComposingsemantics:KeyboardEvent.isComposingistruefromcompositionstartuntil aftercompositionend. This means the Enter that fires immediately after the finalcompositionendmay still carryisComposing: truein some browser/OS combinations (notably older Chrome on macOS). This is the standard recommendation from MDN and is the same guard used widely in web apps for this pattern.React.KeyboardEventdoes not exposeisComposing. ThehandleTaskSearchKeyDownhandler correctly readsevent.nativeEvent.isComposingto reach the underlying DOM event.KeyboardEvent.isComposingis supported on all modern browsers across macOS, Linux, and Windows. No platform-specific shortcuts, labels, file paths, or Electron IPC are touched by this change. The fix applies equally to all IME users regardless of platform.shouldSuppressEnterSubmitcontinues to block Shift+Enter in textareas.No issues flagged requiring changes beyond what is already in this PR.
Security Audit
No security risks identified.
Notes
isComposingproperty is read from the native DOM event for React synthetic events — this is the correct and documented approach.X Account
https://x.com/w_q_r_q