Add support for `event.code`
- 主要语言
- JavaScript
- 星标
- 3.3k
- 派生
- 99
- 平均合并
- 14 小时 22 分钟
- 30 天内合并 PR
- 6
描述
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.)
贡献指南
调研方向
未指定文件或测试。首先定位现有的 event.key 快捷键匹配路径,并检查方括号中的绑定如何表示 [KeyA] 这类 event.code 值。完成的标准是:物理按键绑定能够用于 WASD 导航等示例,同时不会破坏现有快捷键。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- javascript
- 领域
- frontend
- Issue 类型
- 功能
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 38/100