fix: recover keyboard input when Chromium reports keyCode 229 with no IME active - #335
Open
drewvogg wants to merge 1 commit into
Open
fix: recover keyboard input when Chromium reports keyCode 229 with no IME active#335drewvogg wants to merge 1 commit into
drewvogg wants to merge 1 commit into
Conversation
…eyCode 229 Some Windows + Chromium configurations report keyCode 229 for every keydown on a text field, even when no IME is active. The unconditional early return in the keydown handler then drops every keystroke, while mouse input keeps working -- users can click in the live view but cannot type anywhere, including the browser's own address bar. interpret_event() only interprets an event log that begins with a keydown or a keyup, so the keypress following a dropped keydown is orphaned and never interpreted. That is why no key works rather than only some. Fall through instead of returning, and skip only genuine composition (isComposing, or the "Process" sentinel for the composition-starting keydown, where isComposing is still false). This recovers both observed shapes of the quirk: keyCode 229 with a usable key string resolves via the existing key-over-keyCode preference in KeydownEvent, and keyCode 229 with key "Unidentified" resolves from the following keypress. Co-Authored-By: Claude Opus 5 <noreply@anthropic.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.
Checklist
Problem
On certain end-user machines the live view accepts mouse input but silently drops all keyboard input — including in the remote Chromium's own address bar, so it is not page-specific. Full detail in #334.
The keydown handler returns unconditionally on
keyCode === 229:That is correct for genuine IME composition, but some Windows + Chromium configurations report
keyCode 229for every keydown on a text field with no IME active (crbug 864911; same symptom downstream in react#14512, select2#2482). On those machines every keystroke is discarded.The failure is total rather than partial because
interpret_event()only interprets a log beginning with aKeydownEventorKeyupEvent— there is no branch for a leadingKeypressEvent, so the keypress after a dropped keydown is orphaned and never interpreted.Change
Fall through instead of returning, skipping only genuine composition:
This recovers both observed shapes of the quirk, using machinery already in the file:
keyCode 229with a usablekey("a","Enter") —KeydownEventalready preferskeyoverkeyCodewhen resolving a keysym (L268-269), so it resolves correctly.keyCode 229withkey === "Unidentified"(the react#14512 shape) — the keydown resolves to a null keysym, andinterpret_event()then takes the keysym from the following keypress (L1168-1172). This is layout-correct, since keypresscharCodeis the character actually typed rather than a physical key position.Both checks are needed for composition:
isComposingis the authoritative signal, but it is stillfalseon the very first keydown that starts composition, which is where the"Process"sentinel applies. Notee.isComposingis read from the raw event becauseKeyEventdoes not copy that property.The change is marked
KERNEL:in-line, matching the existingNEKO:convention for local deviations in this vendored file, so it is visible during future upstream syncs.Verification
Driving the real module with synthetic events, before and after. The harness reproduces the bug on
mainand confirms the fix, including that genuine IME composition is still suppressed:I did not add this as a test file, since the client has no test runner configured (
package.jsonhasserve/build/lintonly) and the file is vendored. Happy to contribute it under whatever layout you'd prefer if useful.Reproduction harness (
node test-229.mjs <path-to-guacamole-keyboard.js>)What I could not verify
Stating this plainly so you can weigh it: we were not able to capture
keydownevents from an affected machine. The users are at a customer site where we could not get devtools output. So thekeyCode 229diagnosis is inferred — from the symptom set (mouse works, focus works, the remote address bar is equally unaffected by typing, and the same session and live view URL work fine for other users on other machines) plus reading this file, where the 229 guard is the only silent, keyboard-only, machine-configuration-dependent early return in the keydown path.If you would like that confirmed before merging, the check on an affected machine is:
keyCode === 229on ordinary keys confirms it. I'm glad to carry that back to the customer if you'd rather have the evidence first, and equally happy to adjust the approach if you'd prefer to solve it elsewhere in the stack.Reported originally as a live view issue by a Kernel customer of ours; the end-user workaround in the meantime is to remove secondary languages under Windows Settings → Time & Language → Language, then restart the browser.
🤖 Generated with Claude Code
Note
Low Risk
Single, localized change to vendored keyboard event filtering with explicit IME safeguards; affects client input path only, not auth or data handling.
Overview
Fixes total loss of keyboard input in the live view Guacamole client on some Windows + Chromium setups where every
keydownreportskeyCode229 even with no IME active.The vendored
guacamole-keyboard.jskeydown handler no longer drops all229events. It still ignores real composition (isComposingorkey === 'Process') but logs and interprets false229keydowns, using existingkey/ follow-upkeypressresolution so remote typing works again.Reviewed by Cursor Bugbot for commit 958fc1f. Bugbot is set up for automated code reviews on this repo. Configure here.