Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: allow consumers to configure ModalDialog to allow overflow #2939

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/Modal/ModalDialog.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ function ModalDialog({
isFullscreenOnMobile,
isBlocking,
zIndex,
isOverflowVisible,
}) {
const isMobile = useMediaQuery({ query: '(max-width: 767.98px)' });
const showFullScreen = (isFullscreenOnMobile && isMobile);
Expand All @@ -44,6 +45,7 @@ function ModalDialog({
[`pgn__modal-${showFullScreen ? 'fullscreen' : size}`]: size,
[`pgn__modal-${variant}`]: variant,
'pgn__modal-scroll-fullscreen': isFullscreenScroll,
'pgn__modal-visible-overflow': isOverflowVisible,
},
className,
)}
Expand Down Expand Up @@ -120,6 +122,8 @@ ModalDialog.propTypes = {
* Specifies the z-index of the modal
*/
zIndex: PropTypes.number,
/** Specifies whether overflow is visible in the modal */
isOverflowVisible: PropTypes.bool,
};

ModalDialog.defaultProps = {
Expand All @@ -133,6 +137,7 @@ ModalDialog.defaultProps = {
isFullscreenOnMobile: false,
isBlocking: false,
zIndex: undefined,
isOverflowVisible: true,
};

ModalDialog.Header = ModalDialogHeader;
Expand Down
10 changes: 10 additions & 0 deletions src/Modal/_ModalDialog.scss
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,14 @@
top: calc(#{$modal-inner-padding} / 2 * -1);
}
}

&.pgn__modal-visible-overflow {
overflow: visible;

.pgn__modal-body {
overflow: visible;
}
}
Comment on lines +42 to +48
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please try this. I think this option looks better:

Suggested change
&.pgn__modal-visible-overflow {
overflow: visible;
.pgn__modal-body {
overflow: visible;
}
}
&.pgn__modal-visible-overflow .pgn__modal-body {
overflow: visible;
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That doesn't work as we need to overflow both pgn__modal-body and pgn__modal. Your suggestion is missing the

  &.pgn__modal-visible-overflow {
    overflow: visible;
  }

part.

}

// Sizes
Expand Down Expand Up @@ -94,6 +102,8 @@
justify-content: center;
position: sticky;
top: 0;
border-top-left-radius: $modal-content-border-radius;
border-top-right-radius: $modal-content-border-radius;
padding: $modal-header-padding;
background-color: $modal-content-bg;
transition: box-shadow 150ms ease;
Expand Down