Mastodon Feed: Post

Mastodon Feed

Reblogged by collinsworth@hachyderm.io ("Josh Collinsworth"):

0xSim@hachyderm.io wrote:

If you're making a JavaScript game that takes keyboard input, please use the KeyboardEvent.code attribute (instead of .key).

https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/code

> this property returns a value that isn't altered by keyboard layout or the state of the modifier keys.

Your players who don't use a QWERTY layout will thank you.

#javascript #gamedev