Skip to content

Commit 06a07da

Browse files
committed
fix(settings): Top content hidden on mobile
Because: - Without viewport-fit=cover, browsers do not expose env(safe-area-inset-*) values to the page, causing content to render under the status bar or notch in embedded webview contexts - The sticky header would pin beneath the native chrome on scroll without a matching safe area offset This commit: - Adds viewport-fit=cover to the viewport meta tag to unlock safe area inset values on iOS and Android - Adds padding-top: env(safe-area-inset-top) to body to keep content below the status bar on page load - Updates the sticky header's top offset to env(safe-area-inset-top) so it remains visible below the notch when scrolling Closes #FXA-13203
1 parent fc5826e commit 06a07da

3 files changed

Lines changed: 9 additions & 2 deletions

File tree

packages/fxa-react/components/Header/index.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,11 @@ export const Header = (props: HeaderProps) => {
1616
<header
1717
data-testid="header"
1818
role="banner"
19-
className={props.className || 'sticky top-0 bg-grey-10 z-10'}
19+
// top-[env(safe-area-inset-top)] keeps the sticky header below the notch/status bar on scroll
20+
className={
21+
props.className ||
22+
'sticky top-[env(safe-area-inset-top)] bg-grey-10 z-10'
23+
}
2024
style={props.styles}
2125
>
2226
<div className="px-6 tablet:px-8 py-4 flex justify-between">

packages/fxa-settings/public/index.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@
88
<meta name="description" content="" />
99
<meta name="referrer" content="origin" />
1010
<meta name="robots" content="noindex,nofollow" />
11+
<!-- viewport-fit=cover exposes env(safe-area-inset-*) values for notch/status bar support on iOS and Android -->
1112
<meta name="viewport"
12-
content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=2,user-scalable=yes" />
13+
content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=2,user-scalable=yes,viewport-fit=cover" />
1314
<meta name="fxa-config" content="__SERVER_CONFIG__" />
1415

1516
__AUTH_URL_PRECONNECT__

packages/fxa-settings/src/styles/tailwind.css

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616

1717
body {
1818
@apply text-base font-body bg-grey-10 text-grey-900;
19+
/* Prevent content from rendering under the status bar/notch on devices with display cutouts */
20+
padding-top: env(safe-area-inset-top);
1921
}
2022

2123
.nav-anchor {

0 commit comments

Comments
 (0)