Skip to content

Commit 49a112f

Browse files
fix(app): keep the command palette at a fixed height (#58939)
Co-authored-by: vimtor <vimtor@users.noreply.github.com>
1 parent b79dce4 commit 49a112f

2 files changed

Lines changed: 18 additions & 10 deletions

File tree

‎packages/app/e2e/regression/command-palette.spec.ts‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,3 +232,19 @@ test("navigation replaces commands without retaining disposed owners", async ({
232232
)
233233
expect(warnings).toEqual([])
234234
})
235+
236+
test("keeps the same height as the number of results changes", async ({ page }) => {
237+
const { dialog, input } = await openCommandPalette(page)
238+
const container = page.locator('[data-component="dialog-v2"] [data-slot="dialog-container"]')
239+
const height = async () => (await container.boundingBox())?.height
240+
const initial = await height()
241+
expect(initial).toBe(480)
242+
243+
await input.fill("copy session")
244+
await expect(dialog.getByRole("option")).toHaveCount(1)
245+
expect(await height()).toBe(initial)
246+
247+
await input.fill("zzzz no palette match")
248+
await expect(dialog.getByText("No results found")).toBeVisible()
249+
expect(await height()).toBe(initial)
250+
})

‎packages/app/src/shell/commands/dialog.css‎

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,10 @@
22
overflow: hidden;
33
}
44

5-
/* Anchor to the top edge of where a centered 480px-tall dialog would sit, so the
6-
top stays put while the content-driven height grows and shrinks. */
7-
[data-component="dialog-v2"]:has(.command-palette) {
8-
align-items: flex-start;
9-
}
10-
5+
/* Keep a fixed height so the dialog does not resize as results change while typing. */
116
[data-component="dialog-v2"]:has(.command-palette) [data-slot="dialog-container"] {
127
width: min(calc(100vw - 24px), 640px);
13-
height: auto;
14-
min-height: 280px;
15-
max-height: min(calc(100vh - 96px), 480px);
16-
margin-top: max(48px, calc((100vh - 480px) / 2));
8+
height: min(calc(100vh - 96px), 480px);
179
border-radius: 12px;
1810
background: var(--v2-background-bg-base);
1911
box-shadow: var(--v2-elevation-floating);

0 commit comments

Comments
 (0)