Skip to content

Commit

Permalink
fix: resolve issue described by radix-ui/primitives#1159 by moving mo…
Browse files Browse the repository at this point in the history
…dal content into overlay children
  • Loading branch information
AaronPlave committed Feb 16, 2022
1 parent 66856e8 commit 0580e52
Showing 1 changed file with 19 additions and 17 deletions.
36 changes: 19 additions & 17 deletions src/components/Modal/Modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,24 +80,26 @@ export const Modal = (props: ModalProps) => {

return (
<DialogPrimitive.Root {...modalProps}>
<DialogPrimitive.Overlay className="st-react-modal--overlay" />
<ModalContent className={className}>
<div className="st-react-modal--header">
<div className="st-react-modal--header--title-row">
<ModalTitle asChild>
<div className="st-react-modal--header--text st-typography-header">
{title}
</div>
</ModalTitle>
<DialogPrimitive.Close asChild>
<Button variant="icon">
<IconClose />
</Button>
</DialogPrimitive.Close>
<DialogPrimitive.Overlay className="st-react-modal--overlay">
<ModalContent className={className}>
<div className="st-react-modal--header">
<div className="st-react-modal--header--title-row">
<ModalTitle asChild>
<div className="st-react-modal--header--text st-typography-header">
{title}
</div>
</ModalTitle>
<DialogPrimitive.Close asChild>
<Button variant="icon">
<IconClose />
</Button>
</DialogPrimitive.Close>
</div>
</div>
</div>
{children}
</ModalContent>
{children}
</ModalContent>
</DialogPrimitive.Overlay>

{trigger && <ModalTrigger asChild>{trigger}</ModalTrigger>}
</DialogPrimitive.Root>
);
Expand Down

0 comments on commit 0580e52

Please sign in to comment.