fix(web): respect keyboard layouts for command shortcuts #5021
main fromrefs/pull/5021/head·opened View on GitHubWhat Changed#
- Resolve ordinary Command letter shortcuts from the layout-aware keyboard event key when it is a Latin letter.
- Keep the physical letter-code fallback when the layout produces a non-Latin character or symbol.
- Add regression coverage for Colemak Command shortcuts and the preserved non-Latin fallback.
Why#
macOS software keyboard layouts report both a layout-aware key and a QWERTY-position code. T3 treated both values as equivalent shortcut candidates, so Colemak Command K could be shadowed by Command N and Command E could trigger Command K.
Making a Latin event key authoritative fixes that collision without hardcoding a keyboard layout. Retaining the physical fallback for non-Latin characters and symbols preserves existing shortcuts for non-Latin layouts and macOS Option-modified input.
Verification#
- Focused keybinding unit test: 44 passed
- Targeted formatting and lint checks
- Web typecheck
- Manually verified on macOS with both Colemak and Thai input layouts
Checklist#
- This PR is small and focused
- I explained what changed and why
- I included before/after screenshots for any UI changes (not applicable, no visual UI changes)
- I included a video for animation/interaction changes (not applicable, no animation or interaction presentation changed)
Model: GPT-5.6 Sol | Harness: Codex in T3 Code
Note
Low Risk Small, localized change to web keybinding resolution with targeted unit tests; no auth, data, or API surface changes.
Overview
Fixes ⌘/Ctrl letter shortcuts on alternate macOS layouts (e.g. Colemak) by changing how keyboard events are turned into match keys in resolveEventKeys.
When the normalized event.key is a single Latin letter, matching uses only that layout-aware character. The QWERTY-position letter from event.code is no longer added in that case, so keys like ⌘K no longer collide with bindings on the physical KeyN position.
When event.key is not a Latin letter (symbols, Option-modified characters, or non-Latin input), the physical Key* code fallback is unchanged, so shortcuts such as ⌘K on a Cyrillic layout still resolve via KeyK.
Regression tests cover Colemak ⌘ shortcuts (including that ⌘E does not fire ⌘K) and the non-Latin ⌘K fallback.
Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit f178d47af7781c748ef569e2889684ab103b7a68. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).Note
Fix command shortcut resolution to respect non-Latin keyboard layouts#
Updates resolveEventKeys in keybindings.ts to prefer event.key over the code-derived letter when the key is a single lowercase Latin character. Previously, the code-derived letter (e.g. from event.code) was always included, causing shortcuts to break on layouts like Colemak or when typing non-Latin characters. Now, the code-derived letter is only added when event.key is not a single lowercase Latin letter.
- 1
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:XS
github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched
macroscopeapp[bot](GitHub profile, opens in a new tab) approved these changes
Approvability#
Verdict: Approved a9a7b78
Straightforward bug fix that adds a simple conditional check to respect keyboard layouts (Colemak, non-Latin keyboards) when resolving command shortcuts. The 3-line code change is well-covered by comprehensive new tests.
You can customize Macroscope's approvability policy. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).mapringg(GitHub profile, opens in a new tab) closed this
Sign in to join this conversation.
Important
Review skipped#
Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
.coderabbit.yamlfile in this repository. To trigger a single review, invoke the@coderabbitai reviewcommand.⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID:
a2125fa7-87ba-4bed-a21c-641d54e5cb75You can disable this status message by setting the
reviews.review_statustofalsein the CodeRabbit configuration file.Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
❤️ Share