[Bug] Pressing Esc during IME composition leaves unfinished text and loses input focus

When typing in the chat input box using an IME (Input Method Editor), pressing the Esc key to cancel the current word selection causes the input box to lose focus prematurely. The unconfirmed keystrokes (e.g., pinyin letters) are left behind in the input field instead of being cleared.

Steps to Reproduce:

  1. Go to https://aistudio.google.com/prompts/new_chat

  2. Click on the text input box.

  3. Use an IME (e.g., Sogou Pinyin) to type a word (e.g., type “zhege”), keeping the IME candidate window open.

  4. Press the Esc key to cancel the input.

Expected Behavior: The IME candidate window should close, the unconfirmed text should be cleared, and the input box should retain focus.

Actual Behavior: The unconfirmed text (e.g., “zhe’ge”) remains in the input box, and the input box loses focus immediately.

Environment:

  • OS: macOS 15.6

  • Browser: Google Chrome 146.0.7680.81 (arm64)

  • IME: Sogou Pinyin (Issue persists across multiple IMEs)