mirror of
https://github.com/anomalyco/opencode.git
synced 2026-11-18 07:12:47 +03:00
fix(app): keep the command palette at a fixed height (#58939)
Co-authored-by: vimtor <vimtor@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
Unverified
parent
b79dce4ce3
commit
49a112f18e
@@ -232,3 +232,19 @@ test("navigation replaces commands without retaining disposed owners", async ({
|
||||
)
|
||||
expect(warnings).toEqual([])
|
||||
})
|
||||
|
||||
test("keeps the same height as the number of results changes", async ({ page }) => {
|
||||
const { dialog, input } = await openCommandPalette(page)
|
||||
const container = page.locator('[data-component="dialog-v2"] [data-slot="dialog-container"]')
|
||||
const height = async () => (await container.boundingBox())?.height
|
||||
const initial = await height()
|
||||
expect(initial).toBe(480)
|
||||
|
||||
await input.fill("copy session")
|
||||
await expect(dialog.getByRole("option")).toHaveCount(1)
|
||||
expect(await height()).toBe(initial)
|
||||
|
||||
await input.fill("zzzz no palette match")
|
||||
await expect(dialog.getByText("No results found")).toBeVisible()
|
||||
expect(await height()).toBe(initial)
|
||||
})
|
||||
|
||||
@@ -2,18 +2,10 @@
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
/* Anchor to the top edge of where a centered 480px-tall dialog would sit, so the
|
||||
top stays put while the content-driven height grows and shrinks. */
|
||||
[data-component="dialog-v2"]:has(.command-palette) {
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
/* Keep a fixed height so the dialog does not resize as results change while typing. */
|
||||
[data-component="dialog-v2"]:has(.command-palette) [data-slot="dialog-container"] {
|
||||
width: min(calc(100vw - 24px), 640px);
|
||||
height: auto;
|
||||
min-height: 280px;
|
||||
max-height: min(calc(100vh - 96px), 480px);
|
||||
margin-top: max(48px, calc((100vh - 480px) / 2));
|
||||
height: min(calc(100vh - 96px), 480px);
|
||||
border-radius: 12px;
|
||||
background: var(--v2-background-bg-base);
|
||||
box-shadow: var(--v2-elevation-floating);
|
||||
|
||||
Reference in New Issue
Block a user