From 897f55c88b510219a34a5144b907eed610601492 Mon Sep 17 00:00:00 2001 From: DrSmoothl <1787882683@qq.com> Date: Thu, 16 Jul 2026 15:35:50 +0800 Subject: [PATCH] fix(webui): keep modal controls accessible Increase shared dialog and sheet close targets to 40px on desktop and 44px on mobile while preserving the compact 16px icon. Constrain dialogs to the viewport and scroll their body inside a fixed shell so long forms never move the close control off-screen. --- packages/webui/src/components/ui/dialog.tsx | 20 +++++++++++++++----- packages/webui/src/components/ui/sheet.tsx | 14 +++++++++++--- 2 files changed, 26 insertions(+), 8 deletions(-) diff --git a/packages/webui/src/components/ui/dialog.tsx b/packages/webui/src/components/ui/dialog.tsx index 91a115d8..f413feb6 100644 --- a/packages/webui/src/components/ui/dialog.tsx +++ b/packages/webui/src/components/ui/dialog.tsx @@ -1,6 +1,7 @@ import * as React from 'react'; import * as DialogPrimitive from '@radix-ui/react-dialog'; import { X } from 'lucide-react'; +import { Button } from '@/components/ui/button'; import { cn } from '@/lib/utils'; const Dialog = DialogPrimitive.Root; @@ -36,18 +37,27 @@ const DialogContent = React.forwardRef< // phones (plain `w-full` made the dialog touch both edges). Callers // only ever override `max-w-*` (the desktop cap), so the width floor // here survives those overrides — width and max-width are distinct. - 'fixed left-1/2 top-1/2 z-50 grid w-[calc(100vw_-_2rem)] max-w-lg -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl border bg-card p-6 shadow-lg outline-none', + 'fixed left-1/2 top-1/2 z-50 max-h-[calc(100dvh_-_2rem)] w-[calc(100vw_-_2rem)] max-w-lg -translate-x-1/2 -translate-y-1/2 overflow-hidden rounded-xl border bg-card shadow-lg outline-none', 'data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0', 'data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95', className )} {...props} > - {children} +
+ {children} +
{showClose && ( - - - Close + + )} diff --git a/packages/webui/src/components/ui/sheet.tsx b/packages/webui/src/components/ui/sheet.tsx index 0cee823f..d910983d 100644 --- a/packages/webui/src/components/ui/sheet.tsx +++ b/packages/webui/src/components/ui/sheet.tsx @@ -2,6 +2,7 @@ import * as React from 'react'; import * as DialogPrimitive from '@radix-ui/react-dialog'; import { X } from 'lucide-react'; import { cva, type VariantProps } from 'class-variance-authority'; +import { Button } from '@/components/ui/button'; import { cn } from '@/lib/utils'; const Sheet = DialogPrimitive.Root; @@ -52,9 +53,16 @@ const SheetContent = React.forwardRef {children} {showClose && ( - - - Close + + )}