Repository navigation
fix(web): keep find/replace out of IME composition - #557
Merged
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
keydownhandlers onfindInputandreplaceInputinweb/src/components/TextEditor.jsonly checke.key === 'Enter'and never inspecte.isComposing.Fix
Return early when
e.isComposingis true in both handlers, matching theVoiceSelectorfix. Regular Enter presses and all buttons behave as before.Testing
web/tests/unit/text-editor-ime.test.mjsand registered it inweb/tests/unit/index.test.mjs. It calls the realbindEvents()with element stubs and asserts a composing Enter neither callsfindNext/replaceOnenor 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.CHANGELOG.mdunder Unreleased/Fixed.