Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
fix(frontend): safe DialogContent defaults + AlertDialog for delete confirms (#20590)
boojack79bb5fcbc61b
diff --git a/frontend/AGENTS.md b/frontend/AGENTS.mdindex b644d607c1..8a0f16f35f 100644--- a/frontend/AGENTS.md+++ b/frontend/AGENTS.md@@ -50,6 +50,7 @@ React UI components live in `src/react/components/ui/` and follow shadcn-style p- When adding or changing React overlays, run `pnpm --dir frontend check` or `node frontend/scripts/check-react-layering.mjs` before handing off. The scanner is intended to catch raw high-z overlays, forbidden body portals, and policy drift in feature code.- The scanner is a guardrail, not proof of policy compliance. It intentionally avoids full static analysis, so imported, dynamic, shadowed, or complex expressions may be unresolved; passing the check does not permit raw global z-index overlays or body portals.- **Dialog vs Sheet** — use `<Sheet>` (right-side drawer, in `src/react/components/ui/sheet.tsx`) for **creating or editing a resource**. Use `<Dialog>` for **confirmations, single-field prompts, critical interrupts, and read-only result displays**. The dividing line is whether the user is filling out a form with multiple fields — drawers keep the parent list/table visible behind a scrim and scale to multi-section forms, while dialogs are for short blocking interactions. `AlertDialog` is the right pick for destructive confirms that need an explicit acknowledgment.+- **Dialog sizing contract** — `DialogContent` and `AlertDialogContent` are padded (`p-6`) by default; don't add inner padding wrappers, and override with `p-*` on the content element when needed. `DialogContent` defaults to a wide content size (`max-w-[max(48rem,55vw)]`); pass `max-w-*` (and `w-*` if needed) for smaller dialogs. Keep component defaults free of responsive variants like `2xl:max-w-*` — tailwind-merge can't replace them with a caller's unprefixed utility, so they silently win on wide screens.- **Sheet width tiers** — `<SheetContent>` accepts a `width` variant. Pick the tier that matches the form complexity; don't inline ad-hoc widths. Add a new tier to `sheet.tsx` only if a genuinely new size is needed.- `narrow` (384px) — single-field pickers, short 2–3 field forms, environment/project selection, read-only display sheets- `standard` (704px, default) — 3–6 field forms, permission transfer lists, typical create/edit resources (role, user, group, service account, workload identity, request role)diff --git a/frontend/src/react/components/BannersWrapper.tsx b/frontend/src/react/components/BannersWrapper.tsxindex b12fd60799..fd40c957b8 100644--- a/frontend/src/react/components/BannersWrapper.tsx+++ b/frontend/src/react/components/BannersWrapper.tsx@@ -299,7 +299,7 @@ function BannerUpgradeSubscription() {<Dialog open={showModal} onOpenChange={setShowModal}><DialogContent className="max-w-lg">- <div className="p-6">+ <div><DialogTitle className="mb-4 text-base font-medium">{t("subscription.upgrade-now")}?</DialogTitle>diff --git a/frontend/src/react/components/DataExportButton.tsx b/frontend/src/react/components/DataExportButton.tsxindex bfca12c44f..943d80610c 100644--- a/frontend/src/react/components/DataExportButton.tsx+++ b/frontend/src/react/components/DataExportButton.tsx@@ -485,7 +485,7 @@ export function DataExportButton({{viewMode === "DROPDOWN" && supportPassword && (<Dialog open={showPasswordDialog} onOpenChange={setShowPasswordDialog}><DialogContent className="w-[26rem] max-w-[calc(100vw-4rem)]">- <div className="flex flex-col gap-y-3 p-6">+ <div className="flex flex-col gap-y-3"><DialogTitle>{t("export-data.password-optional")}</DialogTitle><p className="text-sm text-control-light">{t("export-data.password-info")}diff --git a/frontend/src/react/components/SchemaEditorLite/Modals/FunctionNameDialog.tsx b/frontend/src/react/components/SchemaEditorLite/Modals/FunctionNameDialog.tsxindex ec6dda86c3..c17198f569 100644--- a/frontend/src/react/components/SchemaEditorLite/Modals/FunctionNameDialog.tsx+++ b/frontend/src/react/components/SchemaEditorLite/Modals/FunctionNameDialog.tsx@@ -79,7 +79,7 @@ export function FunctionNameDialog({return (<Dialog open={open} onOpenChange={(next) => !next && onClose()}>- <DialogContent>+ <DialogContent className="w-full max-w-md"><DialogTitle>{isCreateMode? t("schema-editor.actions.create-function")diff --git a/frontend/src/react/components/SchemaEditorLite/Modals/ProcedureNameDialog.tsx b/frontend/src/react/components/SchemaEditorLite/Modals/ProcedureNameDialog.tsxindex 02dc592899..e790bad0a6 100644--- a/frontend/src/react/components/SchemaEditorLite/Modals/ProcedureNameDialog.tsx+++ b/frontend/src/react/components/SchemaEditorLite/Modals/ProcedureNameDialog.tsx@@ -79,7 +79,7 @@ export function ProcedureNameDialog({return (<Dialog open={open} onOpenChange={(next) => !next && onClose()}>- <DialogContent>+ <DialogContent className="w-full max-w-md"><DialogTitle>{isCreateMode? t("schema-editor.actions.create-procedure")diff --git a/frontend/src/react/components/SchemaEditorLite/Modals/SchemaNameDialog.tsx b/frontend/src/react/components/SchemaEditorLite/Modals/SchemaNameDialog.tsxindex bd5eed9c19..6b88cd00c2 100644--- a/frontend/src/react/components/SchemaEditorLite/Modals/SchemaNameDialog.tsx+++ b/frontend/src/react/components/SchemaEditorLite/Modals/SchemaNameDialog.tsx@@ -73,7 +73,7 @@ export function SchemaNameDialog({return (<Dialog open={open} onOpenChange={(next) => !next && onClose()}>- <DialogContent>+ <DialogContent className="w-full max-w-md"><DialogTitle>{t("schema-editor.actions.create-schema")}</DialogTitle><div className="mt-4 flex flex-col gap-y-4"><Inputdiff --git a/frontend/src/react/components/SchemaEditorLite/Modals/ViewNameDialog.tsx b/frontend/src/react/components/SchemaEditorLite/Modals/ViewNameDialog.tsxindex fa80d9dd0f..6a3dc62da5 100644--- a/frontend/src/react/components/SchemaEditorLite/Modals/ViewNameDialog.tsx+++ b/frontend/src/react/components/SchemaEditorLite/Modals/ViewNameDialog.tsx@@ -79,7 +79,7 @@ export function ViewNameDialog({return (<Dialog open={open} onOpenChange={(next) => !next && onClose()}>- <DialogContent>+ <DialogContent className="w-full max-w-md"><DialogTitle>{isCreateMode? t("schema-editor.actions.create-view")diff --git a/frontend/src/react/components/sql-review/RuleComponents.tsx b/frontend/src/react/components/sql-review/RuleComponents.tsxindex 7a18382f65..8df8dad49b 100644--- a/frontend/src/react/components/sql-review/RuleComponents.tsx+++ b/frontend/src/react/components/sql-review/RuleComponents.tsx@@ -400,7 +400,7 @@ export function RuleEditDialog({return (<Dialog open onOpenChange={(open) => !open && onCancel()}><DialogContent>- <div className="p-6 flex flex-col gap-y-4">+ <div className="flex flex-col gap-y-4"><div className="flex items-center justify-between"><DialogTitle>{t("sql-review.rule.self")}</DialogTitle><span className="text-sm text-control-placeholder">diff --git a/frontend/src/react/components/ui/dialog.test.tsx b/frontend/src/react/components/ui/dialog.test.tsxindex 5cd6f54802..e55cfb9799 100644--- a/frontend/src/react/components/ui/dialog.test.tsx+++ b/frontend/src/react/components/ui/dialog.test.tsx@@ -84,6 +84,55 @@ describe("Dialog", () => {});});+ test("pads the popup by default and lets callers override sizing", async () => {+ const container = document.createElement("div");+ document.body.appendChild(container);+ const root = createRoot(container);++ await act(async () => {+ root.render(+ <>+ <Dialog open>+ <DialogContent className="default-surface">Default</DialogContent>+ </Dialog>+ <Dialog open>+ <DialogContent className="custom-surface max-w-md p-0">+ Custom+ </DialogContent>+ </Dialog>+ </>+ );+ });++ const overlayRoot = document.getElementById("bb-react-layer-overlay");+ const surfaces = Array.from(+ overlayRoot?.querySelectorAll(".default-surface, .custom-surface") ?? []+ ) as HTMLElement[];+ const defaultSurface = surfaces.find((el) =>+ el.className.includes("default-surface")+ );+ const customSurface = surfaces.find((el) =>+ el.className.includes("custom-surface")+ );++ // Safe defaults: bare <DialogContent> must be padded.+ expect(defaultSurface?.className).toContain("p-6");++ // Caller overrides must fully replace the defaults via tailwind-merge.+ // The default max-w must be a single non-responsive utility — a 2xl:+ // variant would survive the merge and clobber the caller's max-w-* on+ // wide screens (BYT-9699).+ expect(customSurface?.className).toContain("max-w-md");+ expect(customSurface?.className).toContain("p-0");+ expect(customSurface?.className).not.toContain("p-6");+ expect(customSurface?.className).not.toMatch(/2xl:max-w/);+ expect(customSurface?.className).not.toContain("max-w-[max(");++ await act(async () => {+ root.unmount();+ });+ });+test("keeps the agent layer visible to assistive tech when an app dialog opens", async () => {const container = document.createElement("div");document.body.appendChild(container);diff --git a/frontend/src/react/components/ui/dialog.tsx b/frontend/src/react/components/ui/dialog.tsxindex 35bc085e3b..a3f291ff5c 100644--- a/frontend/src/react/components/ui/dialog.tsx+++ b/frontend/src/react/components/ui/dialog.tsx@@ -48,9 +48,13 @@ function DialogContent({ref={ref}className={cn(`fixed left-1/2 top-1/2 ${LAYER_SURFACE_CLASS} -translate-x-1/2 -translate-y-1/2`,- "w-[calc(100vw-8rem)] max-w-3xl 2xl:max-w-[55vw]",+ // Single max-w utility (no responsive variant) so a caller's+ // max-w-* fully replaces it via tailwind-merge; a 2xl: variant+ // here would survive the merge and win the cascade on wide+ // screens, silently overriding the caller's width.+ "w-[calc(100vw-8rem)] max-w-[max(48rem,55vw)]","max-h-[calc(100vh-10rem)] overflow-y-auto",- "rounded-sm bg-background shadow-lg",+ "rounded-sm bg-background p-6 shadow-lg",className)}{...props}diff --git a/frontend/src/react/components/ui/feature-modal.tsx b/frontend/src/react/components/ui/feature-modal.tsxindex 724f6153c5..0b3e1391b5 100644--- a/frontend/src/react/components/ui/feature-modal.tsx+++ b/frontend/src/react/components/ui/feature-modal.tsx@@ -95,7 +95,7 @@ export function FeatureModal({ open, feature, instance, onOpenChange }: Props) {return (<Dialog open={open} onOpenChange={onOpenChange}><DialogContent className="max-w-2xl">- <div className="p-6">+ <div><div className="flex items-center justify-between border-b pb-2 mb-4"><DialogTitle className="text-base font-medium">{title}</DialogTitle>{/* Vue's BBModal had a built-in X close affordance; the Reactdiff --git a/frontend/src/react/pages/project/ProjectDatabaseGroupDetailPage.tsx b/frontend/src/react/pages/project/ProjectDatabaseGroupDetailPage.tsxindex 16e582d6eb..073486dfd5 100644--- a/frontend/src/react/pages/project/ProjectDatabaseGroupDetailPage.tsx+++ b/frontend/src/react/pages/project/ProjectDatabaseGroupDetailPage.tsx@@ -4,12 +4,14 @@ import { useTranslation } from "react-i18next";import { DatabaseGroupForm } from "@/react/components/DatabaseGroupForm";import { FeatureAttention } from "@/react/components/FeatureAttention";import { PermissionGuard } from "@/react/components/PermissionGuard";-import { Button } from "@/react/components/ui/button";import {- Dialog,- DialogContent,- DialogTitle,-} from "@/react/components/ui/dialog";+ AlertDialog,+ AlertDialogContent,+ AlertDialogDescription,+ AlertDialogFooter,+ AlertDialogTitle,+} from "@/react/components/ui/alert-dialog";+import { Button } from "@/react/components/ui/button";import {DropdownMenu,DropdownMenuContent,@@ -173,20 +175,20 @@ export function ProjectDatabaseGroupDetailPage({onDismiss={() => setEditing(false)}/>- <Dialog+ <AlertDialogopen={showDeleteDialog}onOpenChange={(open) => {if (!open) setShowDeleteDialog(false);}}>- <DialogContent>- <DialogTitle>+ <AlertDialogContent>+ <AlertDialogTitle>{t("database-group.delete-group", { name: databaseGroup.title })}- </DialogTitle>- <p className="text-sm text-control-light">+ </AlertDialogTitle>+ <AlertDialogDescription>{t("common.cannot-undo-this-action")}- </p>- <div className="flex justify-end gap-x-2 mt-4">+ </AlertDialogDescription>+ <AlertDialogFooter><Buttonvariant="outline"onClick={() => setShowDeleteDialog(false)}@@ -196,9 +198,9 @@ export function ProjectDatabaseGroupDetailPage({<Button variant="destructive" onClick={handleDelete}>{t("common.delete")}</Button>- </div>- </DialogContent>- </Dialog>+ </AlertDialogFooter>+ </AlertDialogContent>+ </AlertDialog></div>);}diff --git a/frontend/src/react/pages/project/ProjectDatabaseGroupsPage.tsx b/frontend/src/react/pages/project/ProjectDatabaseGroupsPage.tsxindex d499fb4f19..c67dcf587c 100644--- a/frontend/src/react/pages/project/ProjectDatabaseGroupsPage.tsx+++ b/frontend/src/react/pages/project/ProjectDatabaseGroupsPage.tsx@@ -4,12 +4,14 @@ import { useTranslation } from "react-i18next";import { DatabaseGroupTable } from "@/react/components/DatabaseGroupTable";import { FeatureAttention } from "@/react/components/FeatureAttention";import { FeatureBadge } from "@/react/components/FeatureBadge";-import { Button } from "@/react/components/ui/button";import {- Dialog,- DialogContent,- DialogTitle,-} from "@/react/components/ui/dialog";+ AlertDialog,+ AlertDialogContent,+ AlertDialogDescription,+ AlertDialogFooter,+ AlertDialogTitle,+} from "@/react/components/ui/alert-dialog";+import { Button } from "@/react/components/ui/button";import { useProjectByName } from "@/react/hooks/useProjectByName";import { router } from "@/react/router";import {@@ -128,31 +130,31 @@ export function ProjectDatabaseGroupsPage({/></div>- <Dialog+ <AlertDialogopen={deleteTarget !== null}onOpenChange={(open) => {if (!open) setDeleteTarget(null);}}>- <DialogContent>- <DialogTitle>+ <AlertDialogContent>+ <AlertDialogTitle>{deleteTarget? t("database-group.delete-group", { name: deleteTarget.title }): ""}- </DialogTitle>- <p className="text-sm text-control-light">+ </AlertDialogTitle>+ <AlertDialogDescription>{t("common.cannot-undo-this-action")}- </p>- <div className="flex justify-end gap-x-2 mt-4">+ </AlertDialogDescription>+ <AlertDialogFooter><Button variant="outline" onClick={() => setDeleteTarget(null)}>{t("common.cancel")}</Button><Button variant="destructive" onClick={handleDelete}>{t("common.delete")}</Button>- </div>- </DialogContent>- </Dialog>+ </AlertDialogFooter>+ </AlertDialogContent>+ </AlertDialog></div>);}diff --git a/frontend/src/react/pages/project/ProjectWebhookForm.tsx b/frontend/src/react/pages/project/ProjectWebhookForm.tsxindex f27d039ce3..3e16cf0c9c 100644--- a/frontend/src/react/pages/project/ProjectWebhookForm.tsx+++ b/frontend/src/react/pages/project/ProjectWebhookForm.tsx@@ -4,13 +4,15 @@ import { EllipsisVertical, Info } from "lucide-react";import { useCallback, useEffect, useMemo, useState } from "react";import { useTranslation } from "react-i18next";import { RouterLink } from "@/react/components/RouterLink";+import {+ AlertDialog,+ AlertDialogContent,+ AlertDialogDescription,+ AlertDialogFooter,+ AlertDialogTitle,+} from "@/react/components/ui/alert-dialog";import { Button, buttonVariants } from "@/react/components/ui/button";import { Checkbox } from "@/react/components/ui/checkbox";-import {- Dialog,- DialogContent,- DialogTitle,-} from "@/react/components/ui/dialog";import {DropdownMenu,DropdownMenuContent,@@ -572,26 +574,26 @@ export function ProjectWebhookForm({</div>{/* Delete confirmation dialog */}- <Dialog open={deleteOpen} onOpenChange={setDeleteOpen}>- <DialogContent>- <DialogTitle>+ <AlertDialog open={deleteOpen} onOpenChange={setDeleteOpen}>+ <AlertDialogContent>+ <AlertDialogTitle>{t("project.webhook.deletion.confirm-title", {title: state.title,})}- </DialogTitle>- <p className="text-sm text-control-light">+ </AlertDialogTitle>+ <AlertDialogDescription>{t("common.cannot-undo-this-action")}- </p>- <div className="flex justify-end gap-x-2 mt-4">+ </AlertDialogDescription>+ <AlertDialogFooter><Button variant="outline" onClick={() => setDeleteOpen(false)}>{t("common.cancel")}</Button><Button variant="destructive" onClick={deleteWebhook}>{t("common.delete")}</Button>- </div>- </DialogContent>- </Dialog>+ </AlertDialogFooter>+ </AlertDialogContent>+ </AlertDialog></div>);}diff --git a/frontend/src/react/pages/project/ProjectWebhooksPage.tsx b/frontend/src/react/pages/project/ProjectWebhooksPage.tsxindex 6d38bb59ac..ff3d932bc1 100644--- a/frontend/src/react/pages/project/ProjectWebhooksPage.tsx+++ b/frontend/src/react/pages/project/ProjectWebhooksPage.tsx@@ -2,12 +2,14 @@ import { EllipsisVertical, Plus } from "lucide-react";import { useCallback, useMemo, useState } from "react";import { useTranslation } from "react-i18next";import { PermissionGuard } from "@/react/components/PermissionGuard";-import { Button } from "@/react/components/ui/button";import {- Dialog,- DialogContent,- DialogTitle,-} from "@/react/components/ui/dialog";+ AlertDialog,+ AlertDialogContent,+ AlertDialogDescription,+ AlertDialogFooter,+ AlertDialogTitle,+} from "@/react/components/ui/alert-dialog";+import { Button } from "@/react/components/ui/button";import {DropdownMenu,DropdownMenuContent,@@ -123,33 +125,33 @@ export function ProjectWebhooksPage({ projectId }: { projectId: string }) {onDelete={setDeleteTarget}/>- <Dialog+ <AlertDialogopen={deleteTarget !== null}onOpenChange={(open) => {if (!open) setDeleteTarget(null);}}>- <DialogContent>- <DialogTitle>+ <AlertDialogContent>+ <AlertDialogTitle>{deleteTarget? t("project.webhook.deletion.confirm-title", {title: deleteTarget.title,}): ""}- </DialogTitle>- <p className="text-sm text-control-light">+ </AlertDialogTitle>+ <AlertDialogDescription>{t("common.cannot-undo-this-action")}- </p>- <div className="flex justify-end gap-x-2 mt-4">+ </AlertDialogDescription>+ <AlertDialogFooter><Button variant="outline" onClick={() => setDeleteTarget(null)}>{t("common.cancel")}</Button><Button variant="destructive" onClick={handleDelete}>{t("common.delete")}</Button>- </div>- </DialogContent>- </Dialog>+ </AlertDialogFooter>+ </AlertDialogContent>+ </AlertDialog></div>);}