Skip to content

Commit 5a199b0

Browse files
fix: don't try to open command palette if a dialog is already open (#9116)
1 parent eb968a6 commit 5a199b0

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

packages/app/src/context/command.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { createMemo, createSignal, onCleanup, onMount, type Accessor } from "solid-js"
22
import { createSimpleContext } from "@opencode-ai/ui/context"
3+
import { useDialog } from "@opencode-ai/ui/context/dialog"
34

45
const IS_MAC = typeof navigator === "object" && /(Mac|iPod|iPhone|iPad)/.test(navigator.platform)
56

@@ -122,6 +123,7 @@ export function formatKeybind(config: string): string {
122123
export const { use: useCommand, provider: CommandProvider } = createSimpleContext({
123124
name: "Command",
124125
init: () => {
126+
const dialog = useDialog()
125127
const [registrations, setRegistrations] = createSignal<Accessor<CommandOption[]>[]>([])
126128
const [suspendCount, setSuspendCount] = createSignal(0)
127129

@@ -165,7 +167,7 @@ export const { use: useCommand, provider: CommandProvider } = createSimpleContex
165167
}
166168

167169
const handleKeyDown = (event: KeyboardEvent) => {
168-
if (suspended()) return
170+
if (suspended() || dialog.active) return
169171

170172
const paletteKeybinds = parseKeybind("mod+shift+p")
171173
if (matchKeybind(paletteKeybinds, event)) {

0 commit comments

Comments
 (0)