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

Multinational Keyboard Support #32

Closed
spacesvr opened this issue May 9, 2021 · 3 comments
Closed

Multinational Keyboard Support #32

spacesvr opened this issue May 9, 2021 · 3 comments
Labels
bug Something isn't working ui/ux it affects how the user controls their character

Comments

@spacesvr
Copy link
Collaborator

spacesvr commented May 9, 2021

There should be as little friction as possible on the end user, so auto-detecting keyboard layout would be ideal

@spacesvr spacesvr added bug Something isn't working ui/ux it affects how the user controls their character labels May 9, 2021
@alex-shortt
Copy link
Collaborator

@AlaricBaraou
Copy link
Contributor

AlaricBaraou commented Jun 4, 2021

Just tried this example http://output.jsbin.com/noyudo/5
From this article https://hacks.mozilla.org/2017/03/internationalize-your-keyboard-controls/

The main issue remains, for most case we can't detect the layout in order to display the right controls on page load.

We could update the WASD/ZQSD/... indicator when the user press whatever key that correspond to code='KeyW'

There is also this experimental Keyboard API that could allow us to detect the Keyboard layout in some browsers.
https://developer.mozilla.org/en-US/docs/Web/API/Keyboard_API

if (navigator.keyboard) {
  var keyboard = navigator.keyboard;
  keyboard.getLayoutMap()
  .then(keyboardLayoutMap => {
    var upKey = keyboardLayoutMap.get('KeyW');
    window.alert('Press ' + upKey + ' to move up.');
  });
} else {
  // Do something else.
}

@alex-shortt
Copy link
Collaborator

alex-shortt commented Jun 6, 2021

found this, seems like event.code is the right way?

Hubs-Foundation/hubs#2397
Hubs-Foundation/hubs@c544888

you probably can't explicitly detect which keyboard the user is using but just look for the keys in the right position at the very least

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working ui/ux it affects how the user controls their character
Development

No branches or pull requests

3 participants