From 3b44687f9e588132e1e07759331800069f83105f Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Wed, 18 Nov 2026 09:16:38 +0000 Subject: [PATCH 1/3] test(web): Option + a letter records the letter, not the macOS glyph MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Failing test for #38513: Cmd+Option+P on a US Mac records alt+π. Co-Authored-By: Claude Opus 5.5 --- .../components/settings/KeybindingsSettings.logic.test.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/apps/web/src/components/settings/KeybindingsSettings.logic.test.ts b/apps/web/src/components/settings/KeybindingsSettings.logic.test.ts index ff02abc44ec63..7613156ce2176 100644 --- a/apps/web/src/components/settings/KeybindingsSettings.logic.test.ts +++ b/apps/web/src/components/settings/KeybindingsSettings.logic.test.ts @@ -130,6 +130,14 @@ describe("KeybindingsSettings.logic", () => { expected: "alt+1", defaultInput: "alt+1", }, + { + key: "π", + code: "KeyP", + altKey: true, + shiftKey: false, + expected: "alt+p", + defaultInput: "alt+p", + }, ]) { const pressed = { key, From 56b5bcb10f6e7584f79bdf349950545c6f6900af Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Wed, 18 Nov 2026 09:21:54 +0000 Subject: [PATCH 2/3] fix(web): Option + a letter records the letter, not the macOS glyph MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On macOS, Option turns letters into glyphs (Option+P types "π"), and the shortcut recorder kept that glyph because the physical-key fallback has no letter codes. With Alt held, shortcutKeyFromEvent now returns the letter of a KeyA-KeyZ code, so Cmd+Option+P is saved and shown as mod+alt+p. Fixes pingdotgg/t3code#38513 Co-Authored-By: Claude Opus 5.5 --- packages/shared/src/keybindingMatching.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/shared/src/keybindingMatching.ts b/packages/shared/src/keybindingMatching.ts index e6525b53d8777..bf3a8b6199d18 100644 --- a/packages/shared/src/keybindingMatching.ts +++ b/packages/shared/src/keybindingMatching.ts @@ -61,6 +61,9 @@ export function shortcutKeyFromEvent( ): string { const layoutKey = normalizeEventKey(event.key); if (/^[a-z]$/.test(layoutKey)) return layoutKey; + // macOS Option turns letters into glyphs (Option+P types "π"); keep the physical letter. + const letterCode = event.altKey ? event.code?.match(/^Key([A-Z])$/)?.[1] : undefined; + if (letterCode) return letterCode.toLowerCase(); // An unshifted "+" is a dedicated zoom key (German, Spanish, Nordic); Czech types it on Digit1. const isZoomPlus = layoutKey === "+" && !event.shiftKey && !event.altKey; if (isZoomPlus && !event.code?.startsWith("Digit")) return layoutKey; From 599f09883183acd7a398788ba57c47b5f83f2584 Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Sat, 21 Nov 2026 05:17:49 +0000 Subject: [PATCH 3/3] fix(web): only map the US Option glyph back to its letter The previous fix recorded the physical Key[A-Z] letter for any Alt glyph, which relabelled other layouts (Dvorak Option+L as P, AZERTY Option+A as Q) and Windows AltGr characters. Map a glyph back to its letter only when it is the macOS US Option glyph at its own US key, as the recorder already does for US shifted punctuation; everything else keeps its character as before. Co-Authored-By: Claude Opus 5.5 --- .../KeybindingsSettings.logic.test.ts | 17 ++++++++++ packages/shared/src/keybindingMatching.ts | 32 +++++++++++++++++-- 2 files changed, 46 insertions(+), 3 deletions(-) diff --git a/apps/web/src/components/settings/KeybindingsSettings.logic.test.ts b/apps/web/src/components/settings/KeybindingsSettings.logic.test.ts index 7613156ce2176..a45ba1fc547d1 100644 --- a/apps/web/src/components/settings/KeybindingsSettings.logic.test.ts +++ b/apps/web/src/components/settings/KeybindingsSettings.logic.test.ts @@ -138,6 +138,23 @@ describe("KeybindingsSettings.logic", () => { expected: "alt+p", defaultInput: "alt+p", }, + // Dvorak Option+L and AZERTY Option+A: not the US glyph at its US key. + { + key: "¬", + code: "KeyP", + altKey: true, + shiftKey: false, + expected: "alt+¬", + defaultInput: "alt+¬", + }, + { + key: "æ", + code: "KeyQ", + altKey: true, + shiftKey: false, + expected: "alt+æ", + defaultInput: "alt+æ", + }, ]) { const pressed = { key, diff --git a/packages/shared/src/keybindingMatching.ts b/packages/shared/src/keybindingMatching.ts index bf3a8b6199d18..75e6786cd1429 100644 --- a/packages/shared/src/keybindingMatching.ts +++ b/packages/shared/src/keybindingMatching.ts @@ -46,6 +46,32 @@ export const EVENT_CODE_SHORTCUT_KEYS: Readonly> = { Slash: "/", }; +// macOS US layout Option+letter glyphs (Option+P types "π"). Dead keys (E, I, N, U) are absent. +const US_MAC_OPTION_GLYPH_LETTERS: ReadonlyMap = new Map([ + ["å", "a"], + ["∫", "b"], + ["ç", "c"], + ["∂", "d"], + ["ƒ", "f"], + ["©", "g"], + ["˙", "h"], + ["∆", "j"], + ["˚", "k"], + ["¬", "l"], + ["µ", "m"], + ["ø", "o"], + ["π", "p"], + ["œ", "q"], + ["®", "r"], + ["ß", "s"], + ["†", "t"], + ["√", "v"], + ["∑", "w"], + ["≈", "x"], + ["¥", "y"], + ["Ω", "z"], +]); + export function isMacPlatform(platform: string): boolean { return /mac|iphone|ipad|ipod/i.test(platform); } @@ -61,9 +87,9 @@ export function shortcutKeyFromEvent( ): string { const layoutKey = normalizeEventKey(event.key); if (/^[a-z]$/.test(layoutKey)) return layoutKey; - // macOS Option turns letters into glyphs (Option+P types "π"); keep the physical letter. - const letterCode = event.altKey ? event.code?.match(/^Key([A-Z])$/)?.[1] : undefined; - if (letterCode) return letterCode.toLowerCase(); + // Only the US layout's glyph at its own key: other layouts and AltGr keep their character. + const usOptionLetter = event.altKey ? US_MAC_OPTION_GLYPH_LETTERS.get(event.key) : undefined; + if (usOptionLetter && event.code === `Key${usOptionLetter.toUpperCase()}`) return usOptionLetter; // An unshifted "+" is a dedicated zoom key (German, Spanish, Nordic); Czech types it on Digit1. const isZoomPlus = layoutKey === "+" && !event.shiftKey && !event.altKey; if (isZoomPlus && !event.code?.startsWith("Digit")) return layoutKey;