Bug: IME composition (e.g. Chinese input) committed on Enter instead of confirming composition
Bug Description
When using an IME (Input Method Editor) for CJK input (e.g., Chinese Pinyin, Japanese IME), pressing Enter during IME composition directly submits the message instead of confirming the IME input first.
Environment: Codex VS Code Extension
Steps to Reproduce
- Open the Codex extension in VS Code
- When the agent asks a question and the input box is active, switch to a Chinese IME (e.g., Pinyin)
- Type a pinyin sequence (e.g., "nihao") — the IME shows candidate characters in a composition window
- Press Enter to confirm/select the IME composition
Expected Behavior
The first Enter should commit the IME composition text into the input box. The user can then press Enter again to submit.
Actual Behavior
The Enter key bypasses the IME composition and directly submits whatever was already in the input box. The IME input is lost.
Root Cause (Likely)
The input handler is likely listening to keydown events without checking event.isComposing. When an IME is active, isComposing is true, and the Enter key should be allowed to pass through to the IME rather than triggering submission.
Suggested Fix
Add an IME composition guard in the Enter key handler:
if (event.key === "Enter" && !event.isComposing) {
// submit
}
Also consider listening to compositionstart / compositionend events to track IME state explicitly, as isComposing support varies across platforms.
Environment
- OS: macOS (likely affects all platforms with CJK IME)
- Codex VS Code Extension: latest
- IME: macOS built-in Chinese Pinyin input
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗