Skip to content

Commit

Permalink
Fix(web-react): HeaderDialog is now closable on backdrop click
Browse files Browse the repository at this point in the history
- Dialog component now have default value `true` on closeOnBackdropClick

solve #DS-1075
  • Loading branch information
pavelklibani committed Dec 1, 2023
1 parent 30490e6 commit 6cd4c84
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/web-react/src/components/Dialog/Dialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { useCancelEvent, useClickOutside } from '../../hooks';
// Solved using `as MutableRefObject<HTMLDialogElement | null>` but I do not like it

const Dialog = (props: DialogProps, ref: ForwardedRef<HTMLDialogElement | null>): JSX.Element => {
const { children, isOpen, onClose, closeOnBackdropClick, ...restProps } = props;
const { children, isOpen, onClose, closeOnBackdropClick = true, ...restProps } = props;
const dialogElementRef: MutableRefObject<ForwardedRef<HTMLDialogElement | null>> = useRef(ref);
const contentElementRef: MutableRefObject<HTMLElement | null> = useRef(null);

Expand Down
3 changes: 1 addition & 2 deletions packages/web-react/src/components/Modal/Modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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`}
>
Expand Down

0 comments on commit 6cd4c84

Please sign in to comment.