diff --git a/packages/react/src/Dialog/Dialog.tsx b/packages/react/src/Dialog/Dialog.tsx index e52ffa5669..275641539f 100644 --- a/packages/react/src/Dialog/Dialog.tsx +++ b/packages/react/src/Dialog/Dialog.tsx @@ -19,6 +19,7 @@ export type DialogProps = { } & PropsWithChildren> const closeDialog = (event: MouseEvent) => event.currentTarget.closest('dialog')?.close() +const openDialog = (id: string) => (document.querySelector(id) as HTMLDialogElement)?.showModal() const DialogRoot = forwardRef( ( @@ -42,5 +43,5 @@ DialogRoot.displayName = 'Dialog' export const Dialog = Object.assign(DialogRoot, { close: closeDialog, - open: (id: string) => (document.querySelector(id) as HTMLDialogElement)?.showModal(), + open: openDialog, })