Skip to content

Commit

Permalink
fix for non modal dialogs
Browse files Browse the repository at this point in the history
  • Loading branch information
sirineJ committed Nov 29, 2024
1 parent 0e0b1f0 commit 7b1cc74
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/circuit-ui/components/Dialog/Dialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ export const Dialog = forwardRef<HTMLDialogElement, DialogProps>(
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'],
Expand Down Expand Up @@ -183,9 +183,9 @@ export const Dialog = forwardRef<HTMLDialogElement, DialogProps>(
}, [open, isModal, handleDialogClose, hasNativeDialog]);

const onDialogClick = (
e: ClickEvent<HTMLDialogElement> | ClickEvent<HTMLDivElement>,
event: ClickEvent<HTMLDialogElement> | ClickEvent<HTMLDivElement>,
) => {
if (isModal && e.target === e.currentTarget) {
if (isModal && event.target === event.currentTarget) {
handleDialogClose();
}
};
Expand All @@ -196,7 +196,7 @@ export const Dialog = forwardRef<HTMLDialogElement, DialogProps>(
return;
}
dialogElement.classList.remove(classes.show);
if (!hasNativeDialog) {
if (!hasNativeDialog && isModal) {
(dialogElement.nextSibling as HTMLDivElement).classList.remove(
classes['backdrop-visible'],
);
Expand Down

0 comments on commit 7b1cc74

Please sign in to comment.