From 0361182b3d78f42fee0e0f821f3990e2bc427a23 Mon Sep 17 00:00:00 2001 From: Pavel Klibani Date: Thu, 30 Nov 2023 01:04:43 +0100 Subject: [PATCH] Fix(web-react): HeaderDialog is now closable on backdrop click - Dialog component now have default value `true` on closeOnBackdropClick solve #DS-1075 --- packages/web-react/src/components/Dialog/Dialog.tsx | 2 +- packages/web-react/src/components/Modal/Modal.tsx | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/packages/web-react/src/components/Dialog/Dialog.tsx b/packages/web-react/src/components/Dialog/Dialog.tsx index 6eb3a2cd3a..891b92c1d3 100644 --- a/packages/web-react/src/components/Dialog/Dialog.tsx +++ b/packages/web-react/src/components/Dialog/Dialog.tsx @@ -7,7 +7,7 @@ import { useCancelEvent, useClickOutside } from '../../hooks'; // Solved using `as MutableRefObject` but I do not like it const Dialog = (props: DialogProps, ref: ForwardedRef): JSX.Element => { - const { children, isOpen, onClose, closeOnBackdropClick, ...restProps } = props; + const { children, isOpen, onClose, closeOnBackdropClick = true, ...restProps } = props; const dialogElementRef: MutableRefObject> = useRef(ref); const contentElementRef: MutableRefObject = useRef(null); diff --git a/packages/web-react/src/components/Modal/Modal.tsx b/packages/web-react/src/components/Modal/Modal.tsx index 37c45787f2..6827b7d6f5 100644 --- a/packages/web-react/src/components/Modal/Modal.tsx +++ b/packages/web-react/src/components/Modal/Modal.tsx @@ -7,7 +7,7 @@ import { ModalProvider } from './ModalContext'; import Dialog from '../Dialog/Dialog'; const Modal = (props: SpiritModalProps) => { - const { children, isOpen, onClose, closeOnBackdropClick = true, id, ...restProps } = props; + const { children, isOpen, onClose, id, ...restProps } = props; const { classProps } = useModalStyleProps(); const { styleProps, props: otherProps } = useStyleProps(restProps); @@ -27,7 +27,6 @@ const Modal = (props: SpiritModalProps) => { id={id} isOpen={isOpen} onClose={onClose} - closeOnBackdropClick={closeOnBackdropClick} className={classNames(classProps.root, styleProps.className)} aria-labelledby={`${id}__title`} >