fix(computer): use clipboard for all text input on macOS to avoid IME issues#2015
Merged
fix(computer): use clipboard for all text input on macOS to avoid IME issues#2015
Conversation
… issues AppleScript keystroke sends characters through the active input method, which causes character loss and garbled text when Chinese IME is active.
Deploying midscene with
|
| Latest commit: |
540a8e1
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://db64aec0.midscene.pages.dev |
| Branch Preview URL: | https://fix-computer-macos-ime-input.midscene.pages.dev |
… on all platforms IME interference affects all platforms (Windows/Linux have similar Chinese IME issues), so there's no need to distinguish between ASCII and non-ASCII text.
9094352 to
99626cb
Compare
…negation The previous prompt "whether there is no logo1" with an image that IS on the page confused AI models. Changed to use an image (Google logo) that is NOT on the GitHub page, with a straightforward positive question.
yuyutaotao
approved these changes
Feb 14, 2026
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.
Summary
Cmd+V) for text input instead of AppleScriptkeystroke, which sends characters through the active input methodkeystrokewith Chinese IME active could result in "htp" due to the IME consuming some keystrokesRoot Cause
typeStringViaAppleScriptuses AppleScript'skeystrokecommand which simulates key-by-key input. These keystrokes pass through the system's active input method. When a Chinese (or other non-English) IME is active, the keystrokes are intercepted and processed as IME input rather than direct character insertion.Fix
Changed
smartTypeString()on macOS to always usetypeViaClipboard(), which writes text to the clipboard and simulatesCmd+V. Clipboard paste completely bypasses the IME pipeline, making it immune to input method state.Test plan
npx nx test @midscene/computer -- tests/unit-test/input-strategy.test.ts)