[Bug]: Keybindings Editor does not respect users keyboard layout #13229
mbeckenbach(GitHub profile, opens in a new tab) added labelsbug
mbeckenbach(GitHub profile, opens in a new tab) added labelsneeds-triage
juliusmarminge removed labelsneeds-triage
juliusmarminge added labelsaccepted
juliusmarminge added labelsvia-triage
juliusmarminge closed this
Sign in to join this conversation.
Triage#
Confirmed on current
main(f5ef0ddb9). The nightly in this report (0.0.43-nightly.20260923.2135) already contains it. Not already fixed.What you reported. On a German Mac layout, recording Shift plus the
#key in Settings → Keybindings showsshift+\. The same recorder is used for SnapShots. Letters are fine. This key is not.That is what the recorder does. On the German ISO layout (including German on macOS), the key left of Return is labeled
#unshifted and'with Shift. The browser reports that physical key asKeyboardEvent.code === "Backslash". The recorder throws away both#and'and stores the US name of that code,\, then addsshiftbecause Shift was held.shift+\is the only value in the shortcut map that produces a backslash.What the code does#
1. Any non-letter in the US code map is stored as the US glyph.
shortcutKeyFromEventkeepsevent.keyonly when it isa–z. Everything else inEVENT_CODE_SHORTCUT_KEYSis replaced by the US character for thatcode:https://github.com/pingdotgg/t3code/blob/f5ef0ddb90a8c36584e181b1913e7b8a5df30ffc/apps/web/src/keybindings.ts#L59-L94
Backslashis hardcoded to\.BracketLeftis[,Quoteis',Semicolonis;, and the digit row is0–9. A Germanükey (BracketLeft) is recorded as[. The#key is recorded as\.Latin letters stay layout-aware. That split landed in #4469. The punctuation table was expanded later in #8103 (2026-09-08), which is what turns this key into
\.2. Settings and SnapShots both save that string.
The keybinding editor writes it straight into the draft:
https://github.com/pingdotgg/t3code/blob/f5ef0ddb90a8c36584e181b1913e7b8a5df30ffc/apps/web/src/components/settings/KeybindingsSettings.logic.ts#L334-L355
https://github.com/pingdotgg/t3code/blob/f5ef0ddb90a8c36584e181b1913e7b8a5df30ffc/apps/web/src/components/settings/KeybindingsSettings.tsx#L770-L779
SnapShots call the same function:
https://github.com/pingdotgg/t3code/blob/f5ef0ddb90a8c36584e181b1913e7b8a5df30ffc/apps/web/src/components/settings/useSnapShotShortcutRecorder.tsx#L109
The project-script shortcut field does too (
projectScriptEditor.tsx). One recorder, three surfaces.The capture tests lock this in. Shift plus a key whose layout character is
@or"is saved asmod+shift+2ormod+shift+', fromDigit2/Quote, not from the character you typed:https://github.com/pingdotgg/t3code/blob/f5ef0ddb90a8c36584e181b1913e7b8a5df30ffc/apps/web/src/components/settings/KeybindingsSettings.logic.test.ts#L98-L116
3. The saved chord still fires on that physical key.
Runtime matching keeps
event.keyand also adds the US code alias:https://github.com/pingdotgg/t3code/blob/f5ef0ddb90a8c36584e181b1913e7b8a5df30ffc/apps/web/src/keybindings.ts#L96-L109
So a binding stored as
shift+\matches Shift on the#key, because the code alias is\. The editor is mislabeling the key. It is not dropping the chord. SnapShots then register that stored key with Electron (Shift+\), which is again the US name of the same physical key.Shift on that key does not type
#. Unshifted is#, Shift types'. The recorder shows neither.Not a duplicate#
shortcutKeyFromEvent.1rather than!. Same US-physical idea, not this key.Backquotehandling. The#key is not that key.No open issue covers the keybinding or SnapShot recorder replacing layout punctuation with the US
codename.Fix direction#
Recording and matching should not share one US-only token if the label is supposed to be the key the layout produced.
Keep
event.keywhen it is a single printable character (#,',ü,+). Use thecodemap only as an extra match alias for default chords such asmod+[, which is whatresolveEventKeysalready does for letters. TodayshortcutKeyFromEventoverwrites the layout character before the settings draft is saved, so the file never contains#.The capture tests above have to change with that. They currently require the US name.
Workaround#
The
shift+\shown in the editor is this physical key. Leave it if the chord only needs to fire there. It will not display#.A hand-written
shift+#in~/.t3/userdata/keybindings.jsondoes not match Shift on that key: with Shift held,event.keyis'and the code alias is\. The token that matches isshift+\.Accepting as a keybinding-recorder bug. SnapShots are the same function, not a second defect.