Unify dialog close behavior

This commit is contained in:
Gregory Schier
2026-08-17 08:11:19 -07:00
parent c14f6ff3bb
commit f4d9e3f784
5 changed files with 8 additions and 21 deletions
+4 -8
View File
@@ -10,12 +10,13 @@ export interface DialogProps {
children: ReactNode;
open: boolean;
onClose?: () => void;
/** Block dismissal from the backdrop, Escape key, and built-in close button. */
disableClose?: boolean;
disableBackdropClose?: boolean;
title?: ReactNode;
description?: ReactNode;
className?: string;
size?: DialogSize;
/** Hide the built-in close button without changing backdrop or Escape behavior. */
hideX?: boolean;
noPadding?: boolean;
noScroll?: boolean;
@@ -29,7 +30,6 @@ export function Dialog({
open,
onClose,
disableClose,
disableBackdropClose,
title,
description,
hideX,
@@ -44,11 +44,7 @@ export function Dialog({
);
return (
<Overlay
open={open}
onClose={disableClose || disableBackdropClose ? undefined : onClose}
portalName="dialog"
>
<Overlay open={open} onClose={disableClose ? undefined : onClose} portalName="dialog">
<div
role="dialog"
className={classNames(
@@ -116,7 +112,7 @@ export function Dialog({
</div>
{/*Put close at the end so that it's the last thing to be tabbed to*/}
{!hideX && !disableClose && (
{!disableClose && !hideX && (
<div className="ml-auto absolute right-1 top-1">
<IconButton
className="opacity-70 hover:opacity-100"