Paste into a Bot's browser on a layout that does not write Latin letters - #596
Merged
Merged
Conversation
While a person drives a Bot's browser, Ctrl+V or Cmd+V stays in the local page so its paste event can carry the clipboard text across. isPasteShortcut compared KeyboardEvent.key with "v", and on Russian or Greek the V key writes "м" or "ω", so the keystroke was sent to the Bot's browser, the local paste was prevented, and nothing was pasted. It now reads the key through keyOf, the rule the app's shortcuts already use for those layouts. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
kevin9327
requested review from
MikeRyanDev,
davidmckayv,
guidovizoso,
mxmzb and
tylerslaton
as code owners
September 17, 2026 11:19
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
# Conflicts: # CHANGELOG.md
davidmckayv
approved these changes
Sep 18, 2026
davidmckayv
left a comment
Contributor
There was a problem hiding this comment.
Code-verified clean; CI green on this sha.
This was referenced Sep 18, 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.
What this changes
When somebody takes the wheel of a Bot's browser,
LiveScreensends their keystrokes to it, except Ctrl+V / Cmd+V. #422 leaves that shortcut to the local page, so the browser raises apasteevent, andonPastesends the clipboard text across as{ type: "text" }.isPasteShortcutrecognised the shortcut withevent.key.toLowerCase() === "v". That is the same comparison #580 fixed for Shift+N.keyis the character the layout writes, and a layout that writes another script has no key that writes a V:keycode"м"KeyV"ω"KeyV"v"Period"k"KeyVOn those layouts the keydown was forwarded as Ctrl+"м" and
preventDefaultwas called, so the localpasteevent never fired. The person's clipboard never reached the Bot's browser, and pasting a one-time code or a long address while driving did nothing.The fix exports
keyOffromlib/hotkeys/hotkeys.ts, the function #580 added, and uses it inisPasteShortcut. So both places read the key by one rule:keyas before, and the physical key fromcodeonly whenkeyis a single character outside ASCII. The modifier check, the keyup bookkeeping andonPasteare unchanged.Where it runs
textframe is sent that a paste on a Latin layout already sends.Boundary and audit
Changelog
CHANGELOG.mdunderUnreleased.Proof
Three tests are added to
app/tests/live-screen-keyboard.test.tsx, using its existingSocketDouble:key: "м") and on a Greek layout (key: "ω"), both withcode: "KeyV". Each asserts that nothing is sent and the keydown is not prevented.code: "Period") is still paste, and Ctrl on the QWERTY V key, which writes K, is still sent as Ctrl+K. This one passes onmaintoo and is there to keep the Latin behaviour pinned.With
live-screen.tsxfrommain(only the tests added):With the fix:
bun test --coverage tests/live-screen-keyboard.test.tsx tests/hotkey-layouts.test.ts: 12 pass, 0 fail. The changed lines inlive-screen.tsxandhotkeys.tsare covered, and Start a new chat with Shift+N on a layout that does not write Latin letters #580's layout tests still pass against the now exportedkeyOf.main. The 44 failures are the same tests on both runs (serve ports and WebSockets, path handling, locale).bun run typecheck(app, server, worker): exit 0.bunx biome formatandbunx biome lint --error-on-warningson the changed files: clean.The keystrokes in the tests have the shape a browser reports:
keyfrom the layout andcodefrom the physical key. I did not drive a real Bot browser with a Russian layout selected.This PR adds its entry at the top of
## Unreleased, where other open PRs add theirs, so the changelog may conflict. I can rebase if it does.🤖 Generated with Claude Code