github / github/hotkey

Add support for `event.code`

Open
#92 0 comments 2 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
3.3k
Forks
99
Avg merge
14h 22m
Merged PRs (30d)
6

Description

While it may prove impossible to smooth over all OS / keyboard layout differences in `event.key`, providing access to mapping hotkeys to an [`event.code`](https://developer.mozilla.org/en-US/docs/Web/API/UI_Events/Keyboard_event_code_values) may help in some situations (for example WASD navigation)

[VS Code allows this via wrapping the code in `[]`](https://code.visualstudio.com/docs/getstarted/keybindings#_keyboard-layoutindependent-bindings): for example `[KeyA]` would match on `event.code === "KeyA"`.

This allows for some flexibility to map shortcuts to physical locations on the keyboard (eg WASD navigation etc.)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.