Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

non-QWERTY keyboards have incorrect input #1031

Open
Ponali opened this issue May 5, 2024 · 1 comment
Open

non-QWERTY keyboards have incorrect input #1031

Ponali opened this issue May 5, 2024 · 1 comment

Comments

@Ponali
Copy link

Ponali commented May 5, 2024

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.

@SuperMaxusa
Copy link
Contributor

SuperMaxusa commented May 5, 2024

#395 and #831 (comment)

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.

var code = codemap[e.code];

v86/src/browser/keyboard.js

Lines 122 to 126 in c69cbd7

// Mapping from event.code to scancode
var codemap = {
"Escape": 0x0001,
"Digit1": 0x0002,
"Digit2": 0x0003,

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants