diff --git a/packages/circuit-ui/components/Dialog/Dialog.tsx b/packages/circuit-ui/components/Dialog/Dialog.tsx index 1653f6780c..3c56b930e8 100644 --- a/packages/circuit-ui/components/Dialog/Dialog.tsx +++ b/packages/circuit-ui/components/Dialog/Dialog.tsx @@ -154,7 +154,7 @@ export const Dialog = forwardRef( if (!dialogElement.open) { if (isModal) { dialogElement.showModal(); - if (!hasNativeDialog) { + if (!hasNativeDialog && isModal) { // use the polyfill backdrop (dialogElement.nextSibling as HTMLDivElement).classList.add( classes['backdrop-visible'], @@ -183,9 +183,9 @@ export const Dialog = forwardRef( }, [open, isModal, handleDialogClose, hasNativeDialog]); const onDialogClick = ( - e: ClickEvent | ClickEvent, + event: ClickEvent | ClickEvent, ) => { - if (isModal && e.target === e.currentTarget) { + if (isModal && event.target === event.currentTarget) { handleDialogClose(); } }; @@ -196,7 +196,7 @@ export const Dialog = forwardRef( return; } dialogElement.classList.remove(classes.show); - if (!hasNativeDialog) { + if (!hasNativeDialog && isModal) { (dialogElement.nextSibling as HTMLDivElement).classList.remove( classes['backdrop-visible'], );