Keyboard

 from Red Blob Games
17 Jun 2023

These are my notes and tests about keyboard events in web browsers.

The current browser recommendations are to use KeyboardEvent.key[1] to match the current keyboard layout, and KeyboardEvent.code[2] to match the physical key location. Try using Dvorak or a non-US keyboard layout to see how the key will change, but the code will stay the same for the same physical key.

Source: keyboard.js

Email me , or tweet @redblobgames, or comment: