ruffle icon indicating copy to clipboard operation
ruffle copied to clipboard

Problem with Key.getCode on AZERTY keyboard: the layout is always QWERTY on Ruffle

Open Txori opened this issue 3 years ago • 3 comments

Describe the bug

On AZERTY keyboard, pressing the A key should give the code 65. Instead, it gives the code 81 of the Q letter (QWERTY). On Ruffle web version, the layout is always QWERTY. On Ruffle desktop, and Flash Player, it works normally.

I made a simple test to try it out: https://www.txori.com/stuff/ruffle/keycode_azerty.php

Expected behavior

Pressing A on AZERTY should retrieve the A Key.getCode And that goes for every keyboard layouts.

Affected platform

Self-hosted version

Operating system

Windows 10

Browser

Chrome 97

Additional information

No response

Txori avatar Jul 09 '22 10:07 Txori

Thank you for pointing this out, because as a German user, I have been having a similar problem: In Germany, we use a QWERTZ layout (with "Y" and "Z" being switched), and for a lot of Flash games in RuffleWeb, typing the "Z" key returns a "Y" instead (and the other way around).

Would be super-cool if this could be fixed some day! As always: Thanks to all Ruffle contributors, I am so grateful for your work :)

Amseog avatar Sep 06 '22 10:09 Amseog

Ruffle uses KeyboardEvent.code to determine which physical key was pressed. Unfortunately that ignores keyboard layout. KeyboardEvent.key doesn't but that is the actual character, as is a or A if shift is pressed or any other letter in any alphabet.

The documentation has Keyboard.getLayoutMap which is supposed to solve this problem but this isn't supported in all browsers: https://developer.mozilla.org/en-US/docs/Web/API/Keyboard/getLayoutMap. It's actually experimental and it is not sure at all whether it will be supported in the future (security concerns: https://mozilla.github.io/standards-positions/#keyboard-map).

hatal175 avatar Sep 18 '22 20:09 hatal175

For reference, this is related to #1046.

Toad06 avatar Sep 18 '22 21:09 Toad06

any update on this?

mero09-99 avatar Sep 27 '22 13:09 mero09-99