v86 icon indicating copy to clipboard operation
v86 copied to clipboard

non-QWERTY keyboards have incorrect input

Open Ponali opened this issue 1 year ago • 1 comments

hi, my keyboard is in AZERTY, which is the normal type of keyboard for my country, but that causes some problems with input. keys like "," turn into "m" and vice-versa, "a" turns into "q" and vice-versa. with my DOM JS experience, this could be an issue with the keyboard script(s) because it tries to get a QWERTY-reliant value, which doesn't happen with "key" and the deprecated "keyCode". this is just some of my speculation however.

Ponali avatar May 05 '24 08:05 Ponali

#395 and https://github.com/copy/v86/issues/831#issuecomment-1498688296

it tries to get a QWERTY-reliant value, which doesn't happen with "key" and the deprecated "keyCode".

v86 uses event.code, that uses standard QWERTY physical keys layout and not depends by host keyboard layout (https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/code#handle_keyboard_events_in_a_game), and convert to BIOS key codes. https://github.com/copy/v86/blob/c69cbd7854d7cbda08679c389973aa87c9fb37bd/src/browser/keyboard.js#L316 https://github.com/copy/v86/blob/c69cbd7854d7cbda08679c389973aa87c9fb37bd/src/browser/keyboard.js#L122-L126

Workaround is setting on guest OS needed for you layout (for example, via loadkeys, demo: https://copy.sh/v86?profile=archlinux&c=loadkeys%20fr)

SuperMaxusa avatar May 05 '24 14:05 SuperMaxusa