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

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

Open
Txori opened this issue Jul 9, 2022 · 4 comments
Labels
bug Something isn't working input Issues relating to user input in Flash content text Issues relating to text rendering/input

Comments

@Txori
Copy link
Contributor

Txori commented Jul 9, 2022

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 Txori added the bug Something isn't working label Jul 9, 2022
@adrian17 adrian17 added text Issues relating to text rendering/input input Issues relating to user input in Flash content labels Jul 10, 2022
@Amseog
Copy link

Amseog commented Sep 6, 2022

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 :)

@hatal175
Copy link
Contributor

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).

@Toad06
Copy link
Member

Toad06 commented Sep 18, 2022

For reference, this is related to #1046.

@mero09-99
Copy link

any update on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working input Issues relating to user input in Flash content text Issues relating to text rendering/input
Projects
None yet
Development

No branches or pull requests

6 participants