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

Research direction

No files or tests are named. Start by locating the existing event.key shortcut-matching path and review how bracketed bindings could represent event.code values such as [KeyA]. Done means physical-key bindings work for examples such as WASD navigation without breaking existing shortcuts.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.