These are my notes and tests about keyboard events in web browsers.
The current browser recommendations are to use
KeyboardEvent.key to match the current keyboard layout, and
KeyboardEvent.code 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.