Skip to content

fix: suppress Enter submit during IME composition in workflow creation popup#804

Merged
nwparker merged 3 commits into
stablyai:mainfrom
fffk10:fix/ime-composition-enter-submit
Apr 19, 2026
Merged

fix: suppress Enter submit during IME composition in workflow creation popup#804
nwparker merged 3 commits into
stablyai:mainfrom
fffk10:fix/ime-composition-enter-submit

Conversation

@fffk10

@fffk10 fffk10 commented Apr 18, 2026

Copy link
Copy Markdown
Contributor

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 NewWorkspaceComposerModal and NewWorkspacePage checked only event.key === 'Enter' without guarding against event.isComposing.

This PR extracts a pure helper shouldSuppressEnterSubmit() in new-workspace-enter-guard.ts and applies it at every submit-on-Enter site:

Fixes #742.

Screenshots

before fix

output.mp4

after fix

output.mp4

Testing

  • pnpm lint
  • pnpm typecheck
  • pnpm test
  • pnpm build
  • Added or updated high-quality tests that would catch regressions, or explained why tests were not needed
  • When confirming a Japanese IME conversion candidate with Enter, the workflow should not be submitted.

Unit tests added in new-workspace-enter-guard.test.ts covering:

  • Plain Enter with no composition → not suppressed
  • Enter while isComposing: true → suppressed
  • Shift+Enter inside a textarea → suppressed
  • Shift+Enter inside a non-textarea → not suppressed
  • Both isComposing and Shift+Enter in a textarea → suppressed

AI Review Report

Reviewed with Claude Code. Main risks checked:

  • Correctness of isComposing semantics: KeyboardEvent.isComposing is true from compositionstart until after compositionend. This means the Enter that fires immediately after the final compositionend may still carry isComposing: true in 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 SyntheticEvent gap: React.KeyboardEvent does not expose isComposing. The handleTaskSearchKeyDown handler correctly reads event.nativeEvent.isComposing to reach the underlying DOM event.
  • Cross-platform compatibility: KeyboardEvent.isComposing is 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.
  • Shift+Enter preservation: The existing Shift+Enter newline behavior in textarea is preserved — shouldSuppressEnterSubmit continues to block Shift+Enter in textareas.

No issues flagged requiring changes beyond what is already in this PR.

Security Audit

  • No user input is executed, eval'd, or passed to a shell.
  • No file paths, auth tokens, or secrets are handled.
  • No IPC calls are added or modified.
  • The change is a pure event-handler guard with no network or process interaction.

No security risks identified.

Notes

  • The isComposing property is read from the native DOM event for React synthetic events — this is the correct and documented approach.
  • Behavior verified manually with Japanese IME on macOS in the workflow creation popup.

X Account

https://x.com/w_q_r_q

@fffk10
fffk10 marked this pull request as draft April 18, 2026 17:59
fffk10 added 2 commits April 19, 2026 03:03
…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.
@fffk10
fffk10 force-pushed the fix/ime-composition-enter-submit branch from 306a411 to c5c784c Compare April 18, 2026 18:04
@fffk10
fffk10 marked this pull request as ready for review April 18, 2026 18:35
@fffk10

fffk10 commented Apr 18, 2026

Copy link
Copy Markdown
Contributor Author

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.
The fix guards the Enter submit handlers with event.isComposing, so composition Enter events no longer submit the workflow.

Would love to get your review when you have a chance. Thanks!

@nwparker

Copy link
Copy Markdown
Contributor

Thank you for the thorough fix and the unit tests! The isComposing guard is exactly right, and I appreciate the detailed AI review report covering the React SyntheticEvent nuance.

I took the liberty of moving new-workspace-enter-guard.ts from components/ to lib/ since it's a pure utility rather than a component — matches existing conventions (new-workspace.ts etc. live there).

Merging now. Thanks again @fffk10!

@nwparker
nwparker merged commit 5d985a6 into stablyai:main Apr 19, 2026
thomaszdxsn pushed a commit to thomaszdxsn/orca that referenced this pull request Jun 15, 2026
…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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Workflow creation popup submits on Japanese IME Enter confirmation

2 participants