fix(keybindings): show ⇧ for Shift in Windows/Linux shortcut labels (#35754)

* fix(keybindings): show the ⇧ glyph for Shift on Windows and Linux

Spelled-out Shift made non-mac shortcut labels long (Ctrl+Shift+Backspace).

* test(menu): expect the ⇧ glyph in non-mac app menu hints; align double-tap hint
This commit is contained in:
Neil
2026-10-29 00:08:48 -07:00
committed by GitHub
parent b6ffc2079b
commit 3d812eb9bf
12 changed files with 21 additions and 21 deletions
@@ -53,7 +53,7 @@ describe('keybindings', () => {
'Mod+Shift+A'
])
expect(formatKeybindingList(['Mod+Shift+A'], 'darwin')).toBe('⌘⇧A')
expect(formatKeybindingList(['Mod+Shift+A'], 'linux')).toBe('Ctrl+Shift+A')
expect(formatKeybindingList(['Mod+Shift+A'], 'linux')).toBe('Ctrl+⇧+A')
const macChord = {
key: 'a',
+2 -2
View File
@@ -111,7 +111,7 @@ describe('keybindings', () => {
it('formats double-tap bindings as the modifier glyph twice', () => {
expect(formatKeybinding('DoubleTap+Shift', 'darwin')).toEqual(['⇧', '⇧'])
expect(formatKeybinding('DoubleTap+Shift', 'linux')).toEqual(['Shift', 'Shift'])
expect(formatKeybinding('DoubleTap+Shift', 'linux')).toEqual(['⇧', '⇧'])
expect(formatKeybinding('DoubleTap+Mod', 'darwin')).toEqual(['⌘', '⌘'])
expect(formatKeybinding('DoubleTap+Mod', 'win32')).toEqual(['Ctrl', 'Ctrl'])
expect(formatKeybinding('DoubleTap+Cmd', 'win32')).toEqual(['Cmd', 'Cmd'])
@@ -119,7 +119,7 @@ describe('keybindings', () => {
// Ctrl's glyph ⌃ diverges from Mod's ⌘ on Mac, so cover it explicitly.
expect(formatKeybinding('DoubleTap+Ctrl', 'darwin')).toEqual(['⌃', '⌃'])
expect(formatKeybindingList(['DoubleTap+Shift'], 'darwin')).toBe('⇧ ⇧')
expect(formatKeybindingList(['DoubleTap+Shift'], 'linux')).toBe('Shift Shift')
expect(formatKeybindingList(['DoubleTap+Shift'], 'linux')).toBe('⇧ ⇧')
})
it('reports conflicts across two double-tap bindings', () => {
+2 -2
View File
@@ -169,9 +169,9 @@ describe('keybindings', () => {
it('formats keybindings with platform labels', () => {
expect(formatKeybindingList(['Mod+Shift+J'], 'darwin')).toBe('⌘⇧J')
expect(formatKeybindingList(['Mod+Shift+J'], 'linux')).toBe('Ctrl+Shift+J')
expect(formatKeybindingList(['Mod+Shift+J'], 'linux')).toBe('Ctrl+⇧+J')
expect(formatKeybindingList(['Mod+Shift+Backspace'], 'darwin')).toBe('⌘⇧⌫')
expect(formatKeybindingList(['Mod+Shift+Backspace'], 'linux')).toBe('Ctrl+Shift+Backspace')
expect(formatKeybindingList(['Mod+Shift+Backspace'], 'linux')).toBe('Ctrl+⇧+Backspace')
expect(formatKeybindingList([], 'win32')).toBe('Unassigned')
})
+2 -2
View File
@@ -32,7 +32,7 @@ function formatModifierGlyph(modifier: ModifierToken, isMac: boolean): string {
case 'Alt':
return isMac ? '⌥' : 'Alt'
case 'Shift':
return isMac ? '⇧' : 'Shift'
return '⇧'
}
}
@@ -60,7 +60,7 @@ export function formatKeybinding(binding: string, platform: NodeJS.Platform): st
parts.push(isMac ? '⌥' : 'Alt')
}
if (parsed.shift) {
parts.push(isMac ? '⇧' : 'Shift')
parts.push('⇧')
}
parts.push(formatKeyToken(parsed.key, isMac))
return parts