From 0db2f340f6c637ee957c6d106639ef15df6cb809 Mon Sep 17 00:00:00 2001 From: Dilshod Rasulov Date: Wed, 19 Aug 2026 17:36:20 +0500 Subject: [PATCH] fix: cap dialog grid column so fields cannot overflow the modal The dialog body is a grid whose implicit column is auto-sized, i.e. max-content. Long unbreakable option labels (e.g. CT template file names) widened that column and pushed the select fields and footer buttons past the dialog edge. Use grid-cols-[minmax(0,1fr)] on DialogContent to cap the track at the dialog width, and apply the same guard to the Alert grid template. Verified: dialog scrollWidth now equals clientWidth at both 1280px and 375px viewports, with no horizontal page overflow. --- frontend/src/components/ui/alert.tsx | 2 +- frontend/src/components/ui/dialog.tsx | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/frontend/src/components/ui/alert.tsx b/frontend/src/components/ui/alert.tsx index 454e6d8..c595679 100644 --- a/frontend/src/components/ui/alert.tsx +++ b/frontend/src/components/ui/alert.tsx @@ -4,7 +4,7 @@ import { cva, type VariantProps } from "class-variance-authority" import { cn } from "@/lib/utils" const alertVariants = cva( - "relative grid w-full grid-cols-[0_1fr] items-start gap-x-2.5 gap-y-1 rounded-lg border px-3.5 py-3 text-sm has-[>svg]:grid-cols-[theme(spacing.4)_1fr] [&>svg]:mt-0.5 [&>svg]:size-4", + "relative grid w-full grid-cols-[0_minmax(0,1fr)] items-start gap-x-2.5 gap-y-1 rounded-lg border px-3.5 py-3 text-sm has-[>svg]:grid-cols-[theme(spacing.4)_minmax(0,1fr)] [&>svg]:mt-0.5 [&>svg]:size-4", { variants: { variant: { diff --git a/frontend/src/components/ui/dialog.tsx b/frontend/src/components/ui/dialog.tsx index 8b5e548..e5ee122 100644 --- a/frontend/src/components/ui/dialog.tsx +++ b/frontend/src/components/ui/dialog.tsx @@ -55,7 +55,11 @@ function DialogContent({ className={cn( // Default width: capped at max-w-lg and centered; on small screens w-[calc(100%-2rem)] // keeps a 1rem gap on each side. Individual dialogs override width via their own max-w-*. - "fixed top-1/2 left-1/2 z-50 grid w-[calc(100%-2rem)] max-w-lg -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-popover p-4 text-sm text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none 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", + // grid-cols-[minmax(0,1fr)] caps the implicit column at the dialog + // width: an `auto` track is max-content sized, so long unbreakable + // content (e.g. CT template names) would otherwise widen the column + // and push fields past the dialog edge. + "fixed top-1/2 left-1/2 z-50 grid w-[calc(100%-2rem)] max-w-lg grid-cols-[minmax(0,1fr)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-popover p-4 text-sm text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none 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}