Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(web): respect keyboard layouts for command shortcuts #5021

Closedmapringg(GitHub profile, opens in a new tab)wants to merge 1 commit intomain fromrefs/pull/5021/headopened View on GitHub

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

Macroscope summarized f178d47.
    1. coderabbitai[bot](GitHub profile, opens in a new tab)commented

      Important

      Review skipped

      Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

      ⚙️ Run configuration

      Configuration used: Repository UI

      Review profile: CHILL

      Plan: Pro Plus

      Run ID: a2125fa7-87ba-4bed-a21c-641d54e5cb75

      You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

      Use the checkbox below for a quick retry:

      • 🔍 Trigger review

      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
      Comment `@coderabbitai help` to get the list of available commands.
    2. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched

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

Sign in to join this conversation.