Skip to content

fix(chat): preserve editing and search during IME Escape - #801

Merged
vastsa merged 2 commits into
vastsa:mainfrom
yuxino:codex/fix-ime-escape
Sep 21, 2026
Merged

vastsa merged 2 commits into
vastsa:mainfrom
yuxino:codex/fix-ime-escape

Conversation

@yuxino

@yuxino yuxino commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

Pressing Escape to cancel an IME composition can also cancel a message edit or close global search. The edit loses its unsaved draft. In search, the input already ignores composition keys, but the event bubbles to the dialog's unguarded Escape handler.

To exercise the affected paths:

  1. Edit an existing user message, change its text, start composing with a Chinese/Japanese IME, and press Escape before confirming the composition.
  2. Open global search, start composing in its input, and press Escape before confirming.

When the key event is marked as composing, the editor and its draft should remain open, and search should stay open. This PR adds the existing composition guard to both handlers: two production lines. Ordinary Escape still cancels/closes; ordinary Cmd/Ctrl+Enter still retries an edit, while composing retry keystrokes are ignored.

Merged current main into this branch without rewriting its history. The only conflicts were adjacent additions to the English and Chinese E2E plans; both the IME scenario and main's scheduled-task scenarios are retained.

Validation reran after the merge: the actual production components fail with each original handler restored and pass with the fix. Coverage includes bubbling events, isComposing, legacy keyCode 229, draft preservation, normal Escape (including focus outside the search input), and both retry modifiers. JS build, desktop typecheck, all 2,523 desktop tests, lint/style and documentation checks pass.

This is automated Chromium/Electron component evidence using synthetic keyboard events and host-boundary fixtures. Native OS IME candidate-window behavior has not been verified, and no native recording is claimed. The steps above describe the native path to check, not a completed native reproduction.

Validation details
  • Candidate: 54ba54aee6c91b8fa0a599593ce72244fc26bfaa
  • Base main: 4413e25cb2d9620a570e042d5353960aff9ab696
  • GitHub integration candidate: 761de25a1fd3e64120d9a215b066447ddbf3aad8; its tree is identical to the tested candidate (df8b7d719b04cf4c7f060cbb1f5d01bad31e8b80).
  • Environment: macOS arm64, Node 24.13.0, pnpm 10.34.5.
  • Regression: node scripts/e2e-ime-escape.mjs; old MessageRow fails with “IME Escape discarded message edit”, old SearchDialog fails with “Search consumed IME Escape”; fixed candidate passes.
  • Checks: pnpm build:js, pnpm --filter @pi-desktop/desktop typecheck, pnpm --filter @pi-desktop/desktop test, pnpm lint, pnpm docs:check, pnpm check:pr-base, upstream-main ancestry and git diff --check.
  • No persistence, IPC, permission or migration changes. Full native-app E2E and native IME verification were not run; this update uses the written explanation option. Rust-only checks were not rerun locally because this PR changes only renderer behavior and its tests/docs.

Ignore composition key events before edit shortcuts and the search
Escape handler. Otherwise canceling an IME composition can discard
an edit or close search through event bubbling.
Preserve both IME regression coverage and the scheduled-task scenarios
added on main when resolving the English and Chinese test-plan conflict.
@vastsa
vastsa merged commit 73965fa into vastsa:main Sep 21, 2026
4 checks passed
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.

2 participants