Skip to content

Commit 0f5626d

Browse files
authored
fix(app): prefer cmd+k for command palette (#18731)
1 parent 5ea9545 commit 0f5626d

5 files changed

Lines changed: 21 additions & 5 deletions

File tree

packages/app/e2e/actions.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,9 +175,9 @@ export async function runTerminal(page: Page, input: { cmd: string; token: strin
175175
await expect.poll(() => terminalHas(page, { term, token: input.token }), { timeout }).toBe(true)
176176
}
177177

178-
export async function openPalette(page: Page) {
178+
export async function openPalette(page: Page, key = "K") {
179179
await defocus(page)
180-
await page.keyboard.press(`${modKey}+P`)
180+
await page.keyboard.press(`${modKey}+${key}`)
181181

182182
const dialog = page.getByRole("dialog")
183183
await expect(dialog).toBeVisible()

packages/app/e2e/app/palette.spec.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { test, expect } from "../fixtures"
2-
import { openPalette } from "../actions"
2+
import { closeDialog, openPalette } from "../actions"
33

44
test("search palette opens and closes", async ({ page, gotoSession }) => {
55
await gotoSession()
@@ -9,3 +9,12 @@ test("search palette opens and closes", async ({ page, gotoSession }) => {
99
await page.keyboard.press("Escape")
1010
await expect(dialog).toHaveCount(0)
1111
})
12+
13+
test("search palette also opens with cmd+p", async ({ page, gotoSession }) => {
14+
await gotoSession()
15+
16+
const dialog = await openPalette(page, "P")
17+
18+
await closeDialog(page, dialog)
19+
await expect(dialog).toHaveCount(0)
20+
})

packages/app/e2e/settings/settings-keybinds.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ test("changing file open keybind works", async ({ page, gotoSession }) => {
241241
await expect(keybindButton).toBeVisible()
242242

243243
const initialKeybind = await keybindButton.textContent()
244-
expect(initialKeybind).toContain("P")
244+
expect(initialKeybind).toContain("K")
245245

246246
await keybindButton.click()
247247
await expect(keybindButton).toHaveText(/press/i)

packages/app/src/context/command-keybind.test.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,11 @@ describe("command keybind helpers", () => {
4040
expect(display.includes("Alt") || display.includes("⌥")).toBe(true)
4141
expect(formatKeybind("none")).toBe("")
4242
})
43+
44+
test("formatKeybind prefers the first combo", () => {
45+
const display = formatKeybind("mod+k,mod+p")
46+
47+
expect(display.includes("K") || display.includes("k")).toBe(true)
48+
expect(display.includes("P") || display.includes("p")).toBe(false)
49+
})
4350
})

packages/app/src/pages/session/use-session-commands.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ export const useSessionCommands = (actions: SessionCommandContext) => {
255255
id: "file.open",
256256
title: language.t("command.file.open"),
257257
description: language.t("palette.search.placeholder"),
258-
keybind: "mod+p",
258+
keybind: "mod+k,mod+p",
259259
slash: "open",
260260
onSelect: () => dialog.show(() => <DialogSelectFile onOpenFile={showAllFiles} />),
261261
}),

0 commit comments

Comments
 (0)