Skip to content

Commit

Permalink
fix(dialog): closeOnOverlayClick work in dialog
Browse files Browse the repository at this point in the history
closeOnOverlayClick work in dialog

532
  • Loading branch information
psaren committed Mar 24, 2022
1 parent 890e748 commit 29b8589
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/dialog/RenderDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ const RenderDialog: React.FC<RenderDialogProps> = (props) => {
preventScrollThrough,
closeBtn,
closeOnEscKeydown = true,
closeOnOverlayClick = true,
} = props;
const wrap = useRef<HTMLDivElement>();
const dialog = useRef<HTMLDivElement>();
Expand Down Expand Up @@ -122,7 +123,7 @@ const RenderDialog: React.FC<RenderDialogProps> = (props) => {
};

const onMaskClick = (e: React.MouseEvent<HTMLDivElement>) => {
if (e.target === e.currentTarget) {
if (e.target === e.currentTarget && closeOnOverlayClick) {
onOverlayClick({ e });
onClose({ e, trigger: 'overlay' });
}
Expand Down

0 comments on commit 29b8589

Please sign in to comment.