Skip to content

Fix IME Enter submission handling#146

Merged
warren618 merged 1 commit into
HKUDS:mainfrom
ArthurXi:codex/fix-ime-enter-submit
May 30, 2026
Merged

Fix IME Enter submission handling#146
warren618 merged 1 commit into
HKUDS:mainfrom
ArthurXi:codex/fix-ime-enter-submit

Conversation

@ArthurXi

Copy link
Copy Markdown
Contributor

Summary

  • Fix IME Enter handling in the Agent chat input.
  • Prevent accidental session submission while text composition is active or has just ended.

Why

When using Chinese/Japanese/Korean IMEs, pressing Enter can be used to confirm composition. The chat input previously treated that Enter as a submit action, which could accidentally trigger a session before the user finished typing.

Changes

  • Track IME composition state with onCompositionStart and onCompositionEnd.
  • Ignore Enter submit while composition is active.
  • Add a short guard after composition ends to avoid browser event-order edge cases.

Test Plan

  • Existing tests pass (pytest --ignore=agent/tests/e2e_backtest --tb=short -q)
  • New tests added (if applicable)
  • Tested manually (describe below)

Manual test:

  • Verified that pressing Enter while using an IME to confirm text does not submit the Agent chat.
  • Verified that normal Enter still submits after composition has completed.

Checklist

  • No changes to protected areas (src/agent/, src/session/, src/providers/) without prior discussion
  • No hardcoded values (API keys, file paths, magic numbers)
  • Code follows CONTRIBUTING.md guidelines
  • Documentation updated (if user-facing change)
@warren618 warren618 merged commit 2d07000 into HKUDS:main May 30, 2026
@warren618

Copy link
Copy Markdown
Collaborator

Merged — thanks @ArthurXi! 🙏

This is a real fix for CJK users: confirming a composition with Enter no longer fires an accidental submit. Verified the composition-state tracking (isComposing / keyCode 229 + the post-composition guard) behaves correctly and normal Enter-to-submit still works; TypeScript typecheck is clean. Appreciate the clear write-up of the browser event-order edge case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants