github / github/hotkey

Add support for `event.code`

Offen
#92 0 Kommentare 2 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
JavaScript
Sterne
3.3k
Forks
99
Ø Merge
14 Std. 22 Min.
Gemergte PRs (30 T.)
6

Beschreibung

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.)

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.