diff --git a/src/web-view/src/core/shadcn/dialog.tsx b/src/web-view/src/core/shadcn/dialog.tsx index 5fcd1556..e52ff14f 100644 --- a/src/web-view/src/core/shadcn/dialog.tsx +++ b/src/web-view/src/core/shadcn/dialog.tsx @@ -44,6 +44,41 @@ function DialogOverlay({ ); } +function CustomOverlay({ + className, + ...props +}: React.ComponentProps<"div">) { + React.useEffect(() => { + document.body.classList.add('dialog-open'); + + return () => { + document.body.classList.remove('dialog-open'); + }; + }, []); + + return ( +
{ + if (e.target === e.currentTarget) { + const escEvent = new KeyboardEvent('keydown', { + key: 'Escape', + code: 'Escape', + keyCode: 27, + which: 27, + bubbles: true + }); + document.dispatchEvent(escEvent); + } + }} + {...props} + /> + ); +} + function DialogContent({ className, children, @@ -54,7 +89,7 @@ function DialogContent({ }) { return ( - +