Repository navigation
fix: avoid refocusing find input during IME composition - #320898
Merged
Dmitriy Vasyura (dmitrivMS) merged 5 commits intoSep 6, 2026
Merged
Dmitriy Vasyura (dmitrivMS) merged 5 commits into
Dmitriy Vasyura (dmitrivMS) merged 5 commits into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
This PR improves IME (Input Method Editor) handling in the find widget by adding composition-aware input events and avoiding focus changes during IME sessions.
Changes:
- Add a typed payload to
FindInput.onInputto indicate whether the change came fromcompositionend. - Update
SimpleFindWidgetto conditionally refocus the find box based on IME/composition state. - Prevent
focusFindBox()from running while an IME session is in progress.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/vs/workbench/contrib/codeEditor/browser/find/simpleFindWidget.ts | Avoids refocusing the find box during/around IME composition to prevent disruptive focus churn. |
| src/vs/base/browser/ui/findinput/findInput.ts | Enriches input events with composition provenance so callers can treat IME completion differently. |
Contributor
Author
|
@microsoft-github-policy-service agree |
Contributor
Author
Contributor
Author
|
Hi Dmitriy Vasyura (@dmitrivMS), could you please review this PR when you have a chance and let me know if it’s ready to be merged or if anything needs to be revised? |
Track find input events fired from compositionend so IME-completed input can update search state without immediately restoring focus. Also avoid focus restoration while an IME session is still active.
Wibaek Park (wibaek)
force-pushed
the
fix/webview-find-ime-composition
branch
from
September 4, 2026 17:14
667f4c1 to
adab749
Compare
Observe calls to the real focus methods instead of DOM focus events, which may not be emitted by inactive Electron test windows. Preserve IME regression coverage and normal focus ordering. Co-authored-by: Copilot <[email protected]>
Dmitriy Vasyura (dmitrivMS)
enabled auto-merge (squash)
September 6, 2026 03:15
Dmitriy Vasyura (dmitrivMS)
approved these changes
Sep 6, 2026
Sandeep Somavarapu (sandy081)
approved these changes
Sep 6, 2026
Abdon Morales (abdonmorales)
pushed a commit
to abdonmorales/vscode-utcs
that referenced
this pull request
Sep 23, 2026
…0898) * fix: avoid refocusing find input during IME composition Track find input events fired from compositionend so IME-completed input can update search state without immediately restoring focus. Also avoid focus restoration while an IME session is still active. * test(webview): cover IME focus suppression in find widget * test(webview): make find focus assertions work in Electron Observe calls to the real focus methods instead of DOM focus events, which may not be emitted by inactive Electron test windows. Preserve IME regression coverage and normal focus ordering. Co-authored-by: Copilot <[email protected]> --------- Co-authored-by: Dmitriy Vasyura <[email protected]> Co-authored-by: Copilot <[email protected]> (cherry picked from commit 3d7cfab)
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Fixes #320869
What changed?
Updated the shared find input flow so input events fired from compositionend can update search state without immediately restoring focus to the find box (FindInput.onInput now carries { fromCompositionEnd }). Also added a guard so focusFindBox() does not refocus the find input while an IME composition session is still active.
Why?
focusFindBox() blurs and refocuses the find input (bouncing through the next-match button). When this runs for the input fired at compositionend — or when an async find result arrives while the next character is already composing — the focus change aborts the active IME composition. Korean IME fires compositionend at every syllable boundary, so characters were dropped or corrupted while typing. The search value is still processed as before; only the focus churn around composition is skipped.
How I tested this:
Reproduced the original bug and verified the fix manually with ./scripts/code-web.sh: typing Korean (e.g. 안녕하세요) in the markdown preview find box corrupted characters before this change and is clean after. (Tested on web because webview find is not functional in local desktop builds — stock Electron lacks the findInFrame patch, see #222244.)
Verified English typing, Enter navigation, and find history behavior are unchanged.
npm run compile-check-ts-native and ESLint on the changed files pass.
Before / after
Before:
Before.Current.mov
After:
After.mov