Skip to content

Commit fc4d7b5

Browse files
wojtekmajpmmmwh
andauthored
Fix paddings not taking unsafe area into account (#528)
Co-authored-by: Michael Mok <[email protected]>
1 parent 77be80c commit fc4d7b5

File tree

3 files changed

+14
-4
lines changed

3 files changed

+14
-4
lines changed

overlay/components/PageHeader.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,12 @@ function PageHeader(document, root, props) {
2121
pageHeaderContainer.style.boxShadow = '0 1px 4px rgba(0, 0, 0, 0.3)';
2222
pageHeaderContainer.style.color = '#' + theme.white;
2323
pageHeaderContainer.style.left = '0';
24+
pageHeaderContainer.style.right = '0';
2425
pageHeaderContainer.style.padding = '1rem 1.5rem';
26+
pageHeaderContainer.style.paddingLeft = 'max(1.5rem, env(safe-area-inset-left))';
27+
pageHeaderContainer.style.paddingRight = 'max(1.5rem, env(safe-area-inset-right))';
2528
pageHeaderContainer.style.position = 'fixed';
2629
pageHeaderContainer.style.top = props.topOffset || '0';
27-
pageHeaderContainer.style.width = 'calc(100vw - 3rem)';
2830

2931
const title = document.createElement('h3');
3032
title.innerText = props.title;

overlay/components/RuntimeErrorFooter.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,12 @@ function RuntimeErrorFooter(document, root, props) {
2424
footer.style.boxShadow = '0 -1px 4px rgba(0, 0, 0, 0.3)';
2525
footer.style.height = '2.5rem';
2626
footer.style.left = '0';
27+
footer.style.right = '0';
2728
footer.style.lineHeight = '2.5rem';
29+
footer.style.paddingBottom = '0';
30+
footer.style.paddingBottom = 'env(safe-area-inset-bottom)';
2831
footer.style.position = 'fixed';
2932
footer.style.textAlign = 'center';
30-
footer.style.width = '100vw';
3133
footer.style.zIndex = '2';
3234

3335
const BUTTON_CONFIGS = {

overlay/index.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,10 @@ function IframeRoot(document, root, props) {
7373
iframe.src = 'about:blank';
7474

7575
iframe.style.border = 'none';
76-
iframe.style.height = '100vh';
76+
iframe.style.height = '100%';
7777
iframe.style.left = '0';
78+
iframe.style.minHeight = '100vh';
79+
iframe.style.minHeight = '-webkit-fill-available';
7880
iframe.style.position = 'fixed';
7981
iframe.style.top = '0';
8082
iframe.style.width = '100vw';
@@ -117,10 +119,14 @@ function OverlayRoot(document, root) {
117119
'Segoe UI Symbol',
118120
].join(', ');
119121
div.style.fontSize = '0.875rem';
120-
div.style.height = '100vh';
122+
div.style.height = '100%';
121123
div.style.lineHeight = '1.3';
122124
div.style.overflow = 'auto';
123125
div.style.padding = '1rem 1.5rem 0';
126+
div.style.paddingTop = 'max(1rem, env(safe-area-inset-top))';
127+
div.style.paddingRight = 'max(1.5rem, env(safe-area-inset-right))';
128+
div.style.paddingBottom = 'env(safe-area-inset-bottom)';
129+
div.style.paddingLeft = 'max(1.5rem, env(safe-area-inset-left))';
124130
div.style.width = '100vw';
125131

126132
root.appendChild(div);

0 commit comments

Comments
 (0)