diff --git a/.changeset/mobile-nav-small-viewport.md b/.changeset/mobile-nav-small-viewport.md
new file mode 100644
index 000000000..1a87e039b
--- /dev/null
+++ b/.changeset/mobile-nav-small-viewport.md
@@ -0,0 +1,8 @@
+---
+'@hyperdx/app': patch
+---
+
+fix: keep the team switcher and user preferences reachable in the mobile app
+nav. The app shell and nav were sized with `100vh`, which on mobile browsers
+includes the area behind the retractable toolbar, so the bottom of the nav sat
+off screen with no way to scroll to it. They now size to the small viewport.
diff --git a/packages/app/pages/trace/[traceId].tsx b/packages/app/pages/trace/[traceId].tsx
index 61a1df715..40bf8f9f8 100644
--- a/packages/app/pages/trace/[traceId].tsx
+++ b/packages/app/pages/trace/[traceId].tsx
@@ -28,7 +28,7 @@ export function TraceRedirectPage() {
}, [isReady, replace, traceIdParam]);
return (
-
+
Redirecting to search...
diff --git a/packages/app/src/DBSearchPage.tsx b/packages/app/src/DBSearchPage.tsx
index 814e6d36d..0d883d460 100644
--- a/packages/app/src/DBSearchPage.tsx
+++ b/packages/app/src/DBSearchPage.tsx
@@ -2399,7 +2399,7 @@ function DBSearchPageContent() {
return (
diff --git a/packages/app/src/components/AppNav/AppNav.module.scss b/packages/app/src/components/AppNav/AppNav.module.scss
index 405444075..319a9690b 100644
--- a/packages/app/src/components/AppNav/AppNav.module.scss
+++ b/packages/app/src/components/AppNav/AppNav.module.scss
@@ -58,8 +58,11 @@ $transition-slow: 0.2s ease;
}
.nav {
- height: 100vh;
- max-height: 100vh;
+ // Matches the app shell. The overlay nav is position: fixed with body scroll
+ // locked, so anything laid out past the small viewport is unreachable on a
+ // phone. See --app-viewport-height in styles/globals.css.
+ height: var(--app-viewport-height);
+ max-height: var(--app-viewport-height);
display: flex;
flex-flow: column nowrap;
justify-content: space-between;
diff --git a/packages/app/src/components/PageLayout.module.scss b/packages/app/src/components/PageLayout.module.scss
index ef6ee44f1..0cd2494ad 100644
--- a/packages/app/src/components/PageLayout.module.scss
+++ b/packages/app/src/components/PageLayout.module.scss
@@ -6,7 +6,8 @@
}
.fillViewport {
- height: 100vh;
+ // Same reason the app shell avoids 100vh — see styles/globals.css.
+ height: var(--app-viewport-height);
}
.content {
diff --git a/packages/app/styles/globals.css b/packages/app/styles/globals.css
index c588c07f5..ea9c2a380 100644
--- a/packages/app/styles/globals.css
+++ b/packages/app/styles/globals.css
@@ -33,12 +33,32 @@ a {
background-color: var(--color-text-muted);
}
+/*
+ * Height of a full-viewport, non-scrolling app shell.
+ *
+ * Mobile browsers resolve 100vh against the large viewport, which includes the
+ * area behind the retractable toolbar. A shell sized that way puts its bottom
+ * row off screen, and since the shell itself never scrolls there is no way to
+ * reach it. The small viewport is the part that is always on screen; the
+ * toolbar only retracts when the root document scrolls, which this shell does
+ * not do, so svh is also the steady-state height and never reflows.
+ */
+:root {
+ --app-viewport-height: 100vh;
+}
+
+@supports (height: 100svh) {
+ :root {
+ --app-viewport-height: 100svh;
+ }
+}
+
.app-layout {
- height: 100vh;
+ height: var(--app-viewport-height);
}
.app-layout-with-banner {
- height: 100vh;
+ height: var(--app-viewport-height);
display: grid;
grid-template-rows: auto 1fr;
}
diff --git a/packages/app/tests/e2e/core/mobile-nav.spec.ts b/packages/app/tests/e2e/core/mobile-nav.spec.ts
new file mode 100644
index 000000000..dedc2966a
--- /dev/null
+++ b/packages/app/tests/e2e/core/mobile-nav.spec.ts
@@ -0,0 +1,110 @@
+import type { Page } from '@playwright/test';
+
+import { expect, test } from '../utils/base-test';
+
+/**
+ * iPhone 12 Safari: 390x745 with the browser toolbar retracted, 390x664 with
+ * it on screen. The viewport below is the large one, because that is what
+ * `100vh` resolves to; the toolbar covers the bottom of it.
+ */
+const LARGE_VIEWPORT = { width: 390, height: 745 };
+
+// Playwright has no toolbar emulation, so Chromium's own override stands in for
+// one: it makes `svh` smaller than `lvh` the way a phone with its toolbar on
+// screen does. The value is not in CSS pixels, only "large enough that the two
+// units differ", which the test asserts before relying on it.
+const SMALL_VIEWPORT_DIFFERENCE = 200;
+
+// APP_CONTENT_SCROLL_CONTAINER_ID from src/layout.tsx, inlined because
+// importing that module pulls the whole page tree into the test runtime.
+const APP_CONTENT_SCROLL_CONTAINER_ID = 'app-content-scroll-container';
+
+async function measureViewportHeights(page: Page) {
+ return page.evaluate(() => {
+ const measure = (unit: string) => {
+ const probe = document.createElement('div');
+ probe.style.cssText = `position:fixed;top:0;width:0;height:100${unit}`;
+ document.body.appendChild(probe);
+ const height = probe.getBoundingClientRect().height;
+ probe.remove();
+ return height;
+ };
+ return { small: measure('svh'), large: measure('lvh') };
+ });
+}
+
+async function expectUserMenuOnScreen(page: Page, smallViewportHeight: number) {
+ const userMenu = page.locator('[data-testid="user-menu-trigger"]');
+ await expect(userMenu).toBeVisible();
+ await expect
+ .poll(async () => {
+ const box = await userMenu.boundingBox();
+ return box ? box.y + box.height : Number.POSITIVE_INFINITY;
+ })
+ .toBeLessThanOrEqual(smallViewportHeight);
+ // Fitting inside the small viewport is not enough on its own: a nav that
+ // collapsed to nothing, or one pushed off the top, would also satisfy it.
+ expect((await userMenu.boundingBox())?.y).toBeGreaterThanOrEqual(0);
+}
+
+test.describe('Mobile app shell', { tag: ['@core'] }, () => {
+ test.use({ viewport: LARGE_VIEWPORT, isMobile: true, hasTouch: true });
+
+ test.beforeEach(async ({ page }) => {
+ const cdp = await page.context().newCDPSession(page);
+ await cdp.send('Emulation.setSmallViewportHeightDifferenceOverride', {
+ difference: SMALL_VIEWPORT_DIFFERENCE,
+ });
+ });
+
+ test('keeps the user menu on screen behind a browser toolbar', async ({
+ page,
+ }) => {
+ await page.goto('/search');
+ await expect(page.locator('[data-testid="app-nav"]')).toBeVisible();
+
+ const viewport = await measureViewportHeights(page);
+ // Without this the test would pass vacuously on a browser that ignores the
+ // override, since every viewport unit would resolve to the same height.
+ expect(viewport.small).toBeLessThan(viewport.large);
+
+ const navToggle = page.locator(
+ 'button[aria-label="Collapse/expand navigation"]',
+ );
+
+ await test.step('collapsed rail', async () => {
+ await expect(navToggle).toHaveAttribute('aria-expanded', 'false');
+ await expectUserMenuOnScreen(page, viewport.small);
+ });
+
+ await test.step('expanded overlay', async () => {
+ await navToggle.click();
+ // Without this a dropped click would quietly re-measure the rail.
+ await expect(navToggle).toHaveAttribute('aria-expanded', 'true');
+ await expectUserMenuOnScreen(page, viewport.small);
+ });
+ });
+
+ test('does not leave the page content taller than the shell', async ({
+ page,
+ }) => {
+ await page.goto('/search');
+ await expect(page.locator('[data-testid="search-page"]')).toBeVisible();
+
+ const viewport = await measureViewportHeights(page);
+ expect(viewport.small).toBeLessThan(viewport.large);
+
+ // A page root still sized to the large viewport would overflow the shell
+ // and make the whole app scroll, which it is not meant to do.
+ await expect
+ .poll(async () =>
+ page.evaluate(id => {
+ const scroller = document.getElementById(id);
+ return scroller
+ ? scroller.scrollHeight - scroller.clientHeight
+ : Number.POSITIVE_INFINITY;
+ }, APP_CONTENT_SCROLL_CONTAINER_ID),
+ )
+ .toBe(0);
+ });
+});