Skip to content

Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.

Go

fix(ui): bound dialog height so long content keeps the footer reachable (MUL-7188) (#8209)

Bohan Jiang9fab6da91795
diff --git a/e2e/property-editor-overflow.spec.ts b/e2e/property-editor-overflow.spec.ts
new file mode 100644
index 0000000000..6397959ba1
--- /dev/null
+++ b/e2e/property-editor-overflow.spec.ts
@@ -0,0 +1,45 @@
+import { expect, test } from "@playwright/test";
+import { loginAsDefault, waitForPageText } from "./helpers";
+
+const OPTION_COUNT = 30;
+
+/**
+ * MUL-7188: the property editor is centred by transform and had no height
+ * bound, so a long option list pushed "Save property" below the viewport
+ * where it could not be reached at all — the property became unsaveable.
+ */
+test("keeps the property editor saveable when the option list is long", async ({
+ page,
+}) => {
+ const workspaceSlug = await loginAsDefault(page);
+ const propertyName = `Overflow ${Date.now().toString(36)}`;
+
+ await page.goto(`/${workspaceSlug}/settings?tab=properties`, {
+ waitUntil: "domcontentloaded",
+ });
+ await waitForPageText(page, "Properties");
+ await page.getByRole("button", { name: "New property" }).click();
+ const dialog = page.getByRole("dialog", { name: "New property" });
+ await expect(dialog).toBeVisible();
+
+ await dialog.getByLabel("Name").fill(propertyName);
+ const addOption = dialog.getByRole("button", { name: "Add option" });
+ for (let i = 0; i < OPTION_COUNT - 1; i++) {
+ await addOption.click();
+ }
+ await expect(dialog.getByPlaceholder("Option name")).toHaveCount(OPTION_COUNT);
+ await dialog.getByPlaceholder("Option name").first().fill("Critical");
+
+ const viewport = page.viewportSize();
+ const box = await dialog.boundingBox();
+ if (!viewport || !box) throw new Error("Could not measure the property editor");
+ expect(box.y).toBeGreaterThanOrEqual(0);
+ expect(box.y + box.height).toBeLessThanOrEqual(viewport.height);
+
+ // Clicking rather than asserting visibility: an off-screen footer is what
+ // the report was about, and Playwright refuses to click what it cannot
+ // bring into view.
+ await dialog.getByRole("button", { name: "Save property" }).click();
+ await expect(dialog).not.toBeVisible();
+ await expect(page.getByText(propertyName, { exact: true })).toBeVisible();
+});
diff --git a/packages/ui/components/ui/dialog.tsx b/packages/ui/components/ui/dialog.tsx
index 4c7bb33057..6fc70da891 100644
--- a/packages/ui/components/ui/dialog.tsx
+++ b/packages/ui/components/ui/dialog.tsx
@@ -53,7 +53,15 @@ function DialogContent({
<DialogPrimitive.Popup
data-slot="dialog-content"
className={cn(
- "fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-surface-raised p-4 text-body text-popover-foreground shadow-[var(--floating-shadow)] ring-1 ring-surface-border duration-100 outline-none sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",
+ // The popup is centred by transform, so without a height bound it
+ // grows in both directions and pushes its own footer past the
+ // viewport edge — the save button of a content-driven dialog (a
+ // property with many options, say) becomes unclickable. Cap it to
+ // the viewport and let it scroll as a last resort; a dialog that
+ // fits is unaffected. `overflow-auto` shares tailwind-merge's
+ // conflict group with `overflow-hidden`, so a dialog that manages
+ // its own scrolling still opts out by passing that.
+ "fixed top-1/2 left-1/2 z-50 grid max-h-[calc(100dvh-2rem)] w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 overflow-auto rounded-xl bg-surface-raised p-4 text-body text-popover-foreground shadow-[var(--floating-shadow)] ring-1 ring-surface-border duration-100 outline-none sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",
className
)}
{...props}
diff --git a/packages/views/settings/components/properties-tab.tsx b/packages/views/settings/components/properties-tab.tsx
index 8ea3ef3c9c..9ab24f549d 100644
--- a/packages/views/settings/components/properties-tab.tsx
+++ b/packages/views/settings/components/properties-tab.tsx
@@ -452,7 +452,10 @@ function PropertyEditorDialog({
return (
<Dialog open={open} onOpenChange={onOpenChange}>
- <DialogContent className="sm:max-w-lg">
+ {/* Options are unbounded, so the form is the part that has to give:
+ header and footer stay put and the fields scroll, keeping "Save
+ property" clickable no matter how many options are on the draft. */}
+ <DialogContent className="flex max-h-[85dvh] flex-col sm:max-w-lg">
<DialogHeader>
<DialogTitle>
{property
@@ -463,7 +466,9 @@ function PropertyEditorDialog({
{t(($) => $.properties.editor.admin_hint)}
</DialogDescription>
</DialogHeader>
- <div className="space-y-5 py-2">
+ {/* -mx-1/px-1 keeps the 3px focus ring of an edge-to-edge input from
+ being clipped by the scroll container. */}
+ <div className="-mx-1 min-h-0 flex-1 space-y-5 overflow-y-auto px-1 py-2">
<div className="grid grid-cols-[4.25rem_minmax(0,1fr)_10rem] gap-3">
<div className="space-y-2">
<FieldLabel>{t(($) => $.properties.editor.icon)}</FieldLabel>