fix: remove hasSelectedAgent gate from Cmd+E and focus mode shortcuts

The hasSelectedAgent condition was redundantly gating Cmd+E (toggle right
sidebar) and Cmd+Shift+F (toggle focus mode) behind a pathname check that
Cmd+B and Cmd+. didn't require. The action handler already guards against
invalid states, making the when-clause check unnecessary and broken on the
dev branch's navigation flow.
This commit is contained in:
Mohamed Boudra
2026-04-14 17:34:51 +07:00
parent c80d7a8165
commit 326dad93e4
4 changed files with 7 additions and 32 deletions
@@ -15,7 +15,6 @@ import {
type MessageInputKeyboardActionKind,
type KeyboardShortcutPayload,
} from "@/keyboard/actions";
import { canToggleFileExplorerShortcut } from "@/keyboard/keyboard-shortcut-routing";
import { keyboardActionDispatcher } from "@/keyboard/keyboard-action-dispatcher";
import {
type ChordState,
@@ -32,7 +31,6 @@ export function useKeyboardShortcuts({
enabled,
isMobile,
toggleAgentList,
selectedAgentId,
toggleFileExplorer,
toggleBothSidebars,
toggleFocusMode,
@@ -41,7 +39,6 @@ export function useKeyboardShortcuts({
enabled: boolean;
isMobile: boolean;
toggleAgentList: () => void;
selectedAgentId?: string;
toggleFileExplorer?: () => void;
toggleBothSidebars?: () => void;
toggleFocusMode?: () => void;
@@ -262,19 +259,9 @@ export function useKeyboardShortcuts({
}
return true;
case "sidebar.toggle.right":
if (!toggleFileExplorer) {
return false;
if (toggleFileExplorer) {
toggleFileExplorer();
}
if (
!canToggleFileExplorerShortcut({
selectedAgentId,
pathname,
toggleFileExplorer,
})
) {
return false;
}
toggleFileExplorer();
return true;
case "view.toggle.focus":
if (toggleFocusMode) {
@@ -353,11 +340,6 @@ export function useKeyboardShortcuts({
isDesktop: isDesktopApp,
focusScope,
commandCenterOpen: store.commandCenterOpen,
hasSelectedAgent: canToggleFileExplorerShortcut({
selectedAgentId,
pathname,
toggleFileExplorer,
}),
},
chordState: chordStateRef.current,
onChordReset: () => {
@@ -438,7 +420,6 @@ export function useKeyboardShortcuts({
openProjectPickerAction,
pathname,
resetModifiers,
selectedAgentId,
toggleAgentList,
toggleFileExplorer,
toggleFocusMode,