Skip to content

fix(web): keep find/replace out of IME composition - #557

Merged
remsky merged 1 commit into
remsky:masterfrom
bfs2021:fix/556-texteditor-ime
Oct 28, 2026
Merged

remsky merged 1 commit into
remsky:masterfrom
bfs2021:fix/556-texteditor-ime

Conversation

@bfs2021

@bfs2021 bfs2021 commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

Problem

Pressing Enter in the text editor's find or replace input runs the find/replace action even while an input method is composing text, so confirming a CJK candidate also jumps to the next match or performs a replacement. Same failure mode as #550, fixed there for VoiceSelector.

Fixes #556.

Root cause

The keydown handlers on findInput and replaceInput in web/src/components/TextEditor.js only check e.key === 'Enter' and never inspect e.isComposing.

Fix

Return early when e.isComposing is true in both handlers, matching the VoiceSelector fix. Regular Enter presses and all buttons behave as before.

Testing

  • Added web/tests/unit/text-editor-ime.test.mjs and registered it in web/tests/unit/index.test.mjs. It calls the real bindEvents() with element stubs and asserts a composing Enter neither calls findNext/replaceOne nor prevents default, while a following non-composing Enter does. Both tests fail against the previous handlers.
  • node --test web/tests/unit/text-editor-ime.test.mjs — 2/2 pass.
  • Added the user-visible change to CHANGELOG.md under Unreleased/Fixed.

The find and replace inputs ran on every Enter, including the Enter that
confirms an input-method composition. Skip the handler while
isComposing is true, matching the earlier VoiceSelector fix, and cover
both inputs with a unit test.

Fixes remsky#556

Signed-off-by: bfs2021 <101915083+bfs2021@users.noreply.github.com>
@remsky
remsky merged commit 56609fd into remsky:master Oct 28, 2026
3 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.

IME composition Enter triggers find/replace in TextEditor

2 participants