Compare commits

...

1 Commits

Author SHA1 Message Date
Johnpaul Chiwetelu
9cbdedb5f7 fix: use Ctrl+Shift modifier for sidebar toggle shortcuts
Sidebar toggle shortcuts (w, n, m, a) had no modifier keys, making them
isReservedByTextInput=true. When a sidebar opened and its search box
gained focus, the keybind handler skipped the shortcut, preventing
toggle-off. Adding Ctrl+Shift modifiers (VS Code style) ensures
isReservedByTextInput=false so shortcuts fire even with input focused.

Relocate Comfy.ToggleLinear from Ctrl+Shift+A to Ctrl+Shift+D to avoid
conflict with the new Workspace.ToggleSidebarTab.assets binding.
2026-03-03 16:14:38 +01:00
2 changed files with 82 additions and 1 deletions

View File

@@ -0,0 +1,73 @@
import { describe, expect, it } from 'vitest'
import { KeyComboImpl } from '@/platform/keybindings/keyCombo'
import { CORE_KEYBINDINGS } from './defaults'
function findKeybinding(commandId: string) {
return CORE_KEYBINDINGS.find((kb) => kb.commandId === commandId)
}
describe('CORE_KEYBINDINGS', () => {
describe('sidebar toggle shortcuts use Ctrl+Shift modifier', () => {
const sidebarCommands = [
{
commandId: 'Workspace.ToggleSidebarTab.workflows',
expectedKey: 'w'
},
{
commandId: 'Workspace.ToggleSidebarTab.node-library',
expectedKey: 'n'
},
{
commandId: 'Workspace.ToggleSidebarTab.model-library',
expectedKey: 'm'
},
{
commandId: 'Workspace.ToggleSidebarTab.assets',
expectedKey: 'a'
}
]
it.each(sidebarCommands)(
'$commandId is bound to Ctrl+Shift+$expectedKey',
({ commandId, expectedKey }) => {
const kb = findKeybinding(commandId)
expect(kb).toBeDefined()
expect(kb!.combo).toEqual(
expect.objectContaining({
ctrl: true,
shift: true,
key: expectedKey
})
)
}
)
it.each(sidebarCommands)(
'$commandId is not reserved by text input',
({ commandId }) => {
const kb = findKeybinding(commandId)
const combo = new KeyComboImpl(kb!.combo)
expect(combo.isReservedByTextInput).toBe(false)
}
)
})
it('Comfy.ToggleLinear is bound to Ctrl+Shift+D', () => {
const kb = findKeybinding('Comfy.ToggleLinear')
expect(kb).toBeDefined()
expect(kb!.combo).toEqual(
expect.objectContaining({
ctrl: true,
shift: true,
key: 'd'
})
)
})
it('no keybinding uses Ctrl+Shift+A for ToggleLinear', () => {
const toggleLinear = findKeybinding('Comfy.ToggleLinear')
expect(toggleLinear!.combo.key).not.toBe('a')
})
})

View File

@@ -32,24 +32,32 @@ export const CORE_KEYBINDINGS: Keybinding[] = [
},
{
combo: {
ctrl: true,
shift: true,
key: 'w'
},
commandId: 'Workspace.ToggleSidebarTab.workflows'
},
{
combo: {
ctrl: true,
shift: true,
key: 'n'
},
commandId: 'Workspace.ToggleSidebarTab.node-library'
},
{
combo: {
ctrl: true,
shift: true,
key: 'm'
},
commandId: 'Workspace.ToggleSidebarTab.model-library'
},
{
combo: {
ctrl: true,
shift: true,
key: 'a'
},
commandId: 'Workspace.ToggleSidebarTab.assets'
@@ -58,7 +66,7 @@ export const CORE_KEYBINDINGS: Keybinding[] = [
combo: {
ctrl: true,
shift: true,
key: 'a'
key: 'd'
},
commandId: 'Comfy.ToggleLinear'
},