mirror of
https://github.com/stablyai/orca.git
synced 2026-11-04 19:17:28 +00:00
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:
@@ -30,7 +30,7 @@ function ActionRow({
|
||||
const isMac = navigator.userAgent.includes('Mac')
|
||||
const keys =
|
||||
shortcut === 'alternate'
|
||||
? [isMac ? '⇧' : 'Shift', isMac ? '⌘' : 'Ctrl', 'Click']
|
||||
? ['⇧', isMac ? '⌘' : 'Ctrl', 'Click']
|
||||
: shortcut === 'primary'
|
||||
? [isMac ? '⌘' : 'Ctrl', 'Click']
|
||||
: null
|
||||
|
||||
@@ -62,7 +62,7 @@ export function LinkRoutingPreferenceDialogProvider({
|
||||
const displayHost = displayHostForUrl(displayedRequest?.options.url)
|
||||
const openLinksInAppDefault = displayedRequest?.options.openLinksInAppDefault === true
|
||||
const isMac = navigator.userAgent.includes('Mac')
|
||||
const systemBrowserShortcutKeys = isMac ? ['⇧', '⌘'] : ['Shift', 'Ctrl']
|
||||
const systemBrowserShortcutKeys = isMac ? ['⇧', '⌘'] : ['⇧', 'Ctrl']
|
||||
|
||||
useEffect(() => {
|
||||
setContextualToursBlockingSurfaceVisible(activeRequest !== null)
|
||||
|
||||
@@ -202,7 +202,7 @@ it('updates nominal toggle labels, including an unassigned binding', () => {
|
||||
vi.stubGlobal('navigator', { userAgent: 'Windows NT 10.0' })
|
||||
useAppStore.setState({ keybindings: {} })
|
||||
const view = render(<Harness onSwitchToTerminal={() => {}} />)
|
||||
expect(view.container.textContent).toContain('Ctrl+Shift+J')
|
||||
expect(view.container.textContent).toContain('Ctrl+⇧+J')
|
||||
act(() =>
|
||||
useAppStore.setState({
|
||||
keybindings: { 'terminal.toggleNativeChat': ['Mod+Alt+Y', 'Mod+Alt+K'] }
|
||||
|
||||
@@ -136,7 +136,7 @@ function KeycapArt({ shortcut }: { shortcut: string | null }): React.JSX.Element
|
||||
? formatKeybinding(shortcut, platform)
|
||||
: isMac()
|
||||
? ['⌘', '⌥', '⇧']
|
||||
: ['Ctrl', 'Alt', 'Shift']
|
||||
: ['Ctrl', 'Alt', '⇧']
|
||||
return (
|
||||
<div className="absolute inset-0 flex items-center justify-center gap-2.5">
|
||||
{keys.map((key, index) => (
|
||||
|
||||
@@ -72,7 +72,7 @@ export function ShortcutCommandBlock({
|
||||
const isDigitIndex = isDigitIndexActionId(item.id)
|
||||
const canEnable = isDisabled && previousBindings.length > 0
|
||||
|
||||
const doubleTapHint = platform === 'darwin' ? '⇧⇧' : 'Shift Shift'
|
||||
const doubleTapHint = platform === 'darwin' ? '⇧⇧' : '⇧ ⇧'
|
||||
const recordingMessage = translate(
|
||||
'auto.components.settings.ShortcutCommandBlock.eb72c52c28',
|
||||
'Press a shortcut, or double-tap a modifier (e.g. {{value0}}). Esc cancels.',
|
||||
|
||||
@@ -208,7 +208,7 @@ describe('TerminalContextMenu', () => {
|
||||
|
||||
it('uses nominal primary toggle labels, including default and unbound', () => {
|
||||
for (const [bindings, label] of [
|
||||
[undefined, 'Ctrl+Shift+J'],
|
||||
[undefined, 'Ctrl+⇧+J'],
|
||||
[['Mod+Alt+Y', 'Mod+Alt+K'], 'Ctrl+Alt+Y'],
|
||||
[[], null]
|
||||
] as const) {
|
||||
@@ -236,11 +236,11 @@ describe('TerminalContextMenu', () => {
|
||||
|
||||
renderMenu({ keybindings })
|
||||
|
||||
expect(shortcuts.list).toContain('Ctrl+Shift+C')
|
||||
expect(shortcuts.list).toContain('Ctrl+Shift+A')
|
||||
expect(shortcuts.list).toContain('Ctrl+⇧+C')
|
||||
expect(shortcuts.list).toContain('Ctrl+⇧+A')
|
||||
expect(shortcuts.list).toContain('Ctrl+V')
|
||||
expect(shortcuts.list).toContain('Ctrl+Shift+D')
|
||||
expect(shortcuts.list).toContain('Alt+Shift+D')
|
||||
expect(shortcuts.list).toContain('Ctrl+⇧+D')
|
||||
expect(shortcuts.list).toContain('Alt+⇧+D')
|
||||
expect(shortcuts.list.some((shortcut) => shortcut.includes(','))).toBe(false)
|
||||
})
|
||||
|
||||
|
||||
@@ -111,7 +111,7 @@ describe('shortcut label memoization', () => {
|
||||
const overrides = overridesFor('Mod+Shift+K')
|
||||
expect(formatShortcutLabel('tab.close', overrides)).toBe('⌘⇧K')
|
||||
platformRef.current = 'win32'
|
||||
expect(formatShortcutLabel('tab.close', overrides)).toBe('Ctrl+Shift+K')
|
||||
expect(formatShortcutLabel('tab.close', overrides)).toBe('Ctrl+⇧+K')
|
||||
platformRef.current = 'darwin'
|
||||
expect(formatShortcutLabel('tab.close', overrides)).toBe('⌘⇧K')
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user