From dc6fd0433d4d80c4096d15befba14932ce2e7854 Mon Sep 17 00:00:00 2001 From: Alex Yusiuk <55661041+RRRadicalEdward@users.noreply.github.com> Date: Fri, 22 Aug 2025 10:39:55 +0300 Subject: [PATCH] fix(web): make check for `isUnicodeCharacter` in `sendKeyboard` more strict (#927) This resolves an issue with Unicode input that happens under Chrome. where entering `Alt` codes results in broken modifier state and broken input in general. This happens because of how _Chrome_ handles `KeyboardEvent` key and code in this particular case. For example, holding `Alt`, pressing 1, 2, 3 on a numpad, then releasing `Alt` will result in events with the following key/code values being passed to `sendKeyboard`: `{ "key": "Alt", "code": "AltLeft" ,"type": "keydown" }` `{ "key": "1", "code": "Numpad1" ,"type": "keydown" }` `{ "key": "1", "code": "Numpad1" ,"type": "keyup" }` `{ "key": "2", "code": "Numpad2" ,"type": "keydown" }` `{ "key": "2", "code": "Numpad2" ,"type": "keyup" }` `{ "key": "3", "code": "Numpad3" ,"type": "keydown" }` `{ "key": "3", "code": "Numpad3" ,"type": "keyup" }` `{ "key": "{", "code": "AltLeft" ,"type": "keyup" }` Without this fix, this will send Unicode `{` instead of plain `Alt` to the RDP server, messing up the `Alt` code sequence and leaving `Al` in pressed state. For comparison, in _Firefox_ last event looks like this: `{ "key": "Alt", "code": "AltLeft","type": "keyup" }` --- .../iron-remote-desktop/src/services/remote-desktop.service.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web-client/iron-remote-desktop/src/services/remote-desktop.service.ts b/web-client/iron-remote-desktop/src/services/remote-desktop.service.ts index 4921696a..aa0cbb65 100644 --- a/web-client/iron-remote-desktop/src/services/remote-desktop.service.ts +++ b/web-client/iron-remote-desktop/src/services/remote-desktop.service.ts @@ -343,7 +343,7 @@ export class RemoteDesktopService { } const keyCode = scanCode(evt.key); - const isUnicodeCharacter = Number.isNaN(keyCode) && evt.key.length === 1; + const isUnicodeCharacter = Number.isNaN(keyCode) && evt.key.length === 1 && !isModifierKey; if (isUnicodeCharacter && sendAsUnicode) { this.doTransactionFromDeviceEvents([unicodeEvent(evt.key)]);