Skip to content

Commit e39fcf8

Browse files
dgreifsiddharthkp
andauthored
Use dynamic height and width for dialogs (#4567)
* Use dynamic height and width for dialogs * Update tall-forks-bathe.md --------- Co-authored-by: Siddharth Kshetrapal <[email protected]>
1 parent 32c088d commit e39fcf8

File tree

3 files changed

+16
-11
lines changed

3 files changed

+16
-11
lines changed

.changeset/tall-forks-bathe.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@primer/react': patch
3+
---
4+
5+
Dialog: Use dynamic view height/width. This allows available visible space to be properly computed on iOS devices.

packages/react/src/Dialog.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ const DialogBase = styled.div<StyledDialogBaseProps>`
3333
outline: none;
3434
3535
@media screen and (max-width: 750px) {
36-
width: 100vw;
36+
width: 100dvw;
3737
margin: 0;
3838
border-radius: 0;
39-
height: 100vh;
39+
height: 100dvh;
4040
}
4141
4242
${sx};

packages/react/src/Dialog/Dialog.tsx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -239,8 +239,8 @@ const StyledDialog = styled.div<StyledDialogProps>`
239239
width: ${props => widthMap[props.width ?? ('xlarge' as const)]};
240240
height: ${props => heightMap[props.height ?? ('auto' as const)]};
241241
min-width: 296px;
242-
max-width: calc(100vw - 64px);
243-
max-height: calc(100vh - 64px);
242+
max-width: calc(100dvw - 64px);
243+
max-height: calc(100dvh - 64px);
244244
border-radius: 12px;
245245
opacity: 1;
246246
@@ -257,7 +257,7 @@ const StyledDialog = styled.div<StyledDialogProps>`
257257
}
258258
259259
&[data-position-regular='left'] {
260-
height: 100vh;
260+
height: 100dvh;
261261
max-height: unset;
262262
border-radius: var(--borderRadius-large, 0.75rem);
263263
border-top-left-radius: 0;
@@ -269,7 +269,7 @@ const StyledDialog = styled.div<StyledDialogProps>`
269269
}
270270
271271
&[data-position-regular='right'] {
272-
height: 100vh;
272+
height: 100dvh;
273273
max-height: unset;
274274
border-radius: var(--borderRadius-large, 0.75rem);
275275
border-top-right-radius: 0;
@@ -288,10 +288,10 @@ const StyledDialog = styled.div<StyledDialogProps>`
288288
}
289289
290290
&[data-position-narrow='bottom'] {
291-
width: 100vw;
291+
width: 100dvw;
292292
height: auto;
293-
max-width: 100vw;
294-
max-height: calc(100vh - 64px);
293+
max-width: 100dvw;
294+
max-height: calc(100dvh - 64px);
295295
border-radius: var(--borderRadius-large, 0.75rem);
296296
border-bottom-right-radius: 0;
297297
border-bottom-left-radius: 0;
@@ -303,9 +303,9 @@ const StyledDialog = styled.div<StyledDialogProps>`
303303
304304
&[data-position-narrow='fullscreen'] {
305305
width: 100%;
306-
max-width: 100vw;
306+
max-width: 100dvw;
307307
height: 100%;
308-
max-height: 100vh;
308+
max-height: 100dvh;
309309
border-radius: unset !important;
310310
flex-grow: 1;
311311

0 commit comments

Comments
 (0)