Files
openidea/e2e/dialogTitleBar.spec.ts
T
Ernstjan FreriksandEjaYF 284a287a0f fix(ui): keep dialogs below the macOS window buttons (#2523)
With the overlay title bar, macOS draws the window buttons over the page, so a tall dialog (e.g. Push) or one dragged to the top edge had its title bar covered. The dialog layer now keeps a top margin of at least the title bar height on macOS, and dragging stops there. Windows and Linux are unchanged.

Co-authored-by: EjaYF <9842286+EjaYF@users.noreply.github.com>
2026-11-10 23:16:32 +08:00

29 lines
1.3 KiB
TypeScript

import { test, expect, type Page } from "@playwright/test";
async function titleBarHeight(page: Page) {
return page.evaluate(() => parseFloat(getComputedStyle(document.documentElement).getPropertyValue("--h-titlebar")));
}
// Reduced motion skips the opening animation, which scales the dialog while it runs.
test.use({ viewport: { width: 1200, height: 640 }, reducedMotion: "reduce" });
test("a dialog taller than the window stays below the macOS window buttons", async ({ page }) => {
await page.goto("/e2e/dialogTitleBar.html");
const dialog = page.getByRole("dialog");
await expect(dialog).toBeVisible();
const box = (await dialog.boundingBox())!;
expect(box.y).toBeGreaterThanOrEqual(await titleBarHeight(page));
});
test("dragging a dialog up stops below the macOS window buttons", async ({ page }) => {
await page.goto("/e2e/dialogTitleBar.html");
const title = page.getByRole("dialog").locator("[data-dialog-titlebar] span").last();
const start = (await title.boundingBox())!;
await page.mouse.move(start.x + 40, start.y + start.height / 2);
await page.mouse.down();
await page.mouse.move(start.x + 40, 0, { steps: 8 });
await page.mouse.up();
const box = (await page.getByRole("dialog").boundingBox())!;
expect(box.y).toBeGreaterThanOrEqual(await titleBarHeight(page));
});