Skip to content

Commit cab181c

Browse files
fix(modals): change StyledModal's max-height, when viewport max-height is less than 400 CSS px (#2034)
1 parent 1ed3ab5 commit cab181c

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

packages/modals/src/styled/StyledModal.spec.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ describe('StyledModal', () => {
2222
expect(container.firstChild).not.toHaveStyleRule('direction');
2323
expect(container.firstChild).not.toHaveStyleRule('animation-duration', '0.3s');
2424
expect(container.firstChild).not.toHaveStyleRule('animation-timing-function', 'ease-in-out');
25+
expect(container.firstChild).toHaveStyleRule('max-height', 'calc(100vh - 96px)');
26+
expect(container.firstChild).toHaveStyleRule('max-height', 'calc(100vh - 48px)', {
27+
media: `(max-height: 399px)`
28+
});
2529
});
2630

2731
it('renders RTL styling if provided', () => {

packages/modals/src/styled/StyledModal.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ export const StyledModal = styled.div.attrs<IStyledModalProps>({
100100
top: ${props => props.theme.space.base * 6}px;
101101
bottom: auto;
102102
margin-bottom: ${props => props.theme.space.base * 6}px;
103-
max-height: none;
103+
max-height: calc(100vh - ${props => props.theme.space.base * 12}px);
104104
}
105105
106106
@media screen and (-ms-high-contrast: active), screen and (-ms-high-contrast: none) {

0 commit comments

Comments
 (0)