From f3367f61b5d9ae49d8abab1da04a5d7474525c3b Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Wed, 18 Nov 2026 00:28:58 +0000 Subject: [PATCH 1/5] fix(app): size the app shell to the small viewport on mobile The app shell and nav were sized with 100vh. Mobile browsers resolve that against the large viewport, which includes the area behind the retractable toolbar, so the bottom of the nav - the team switcher and user preferences - sat off screen. The nav is position: fixed while the mobile overlay is open and body scrolling is locked, so there was no way to reach it. Size both to the small viewport instead, via a shared --app-viewport-height custom property with a 100vh fallback for browsers without svh. Co-authored-by: Mike Shi --- .changeset/mobile-nav-small-viewport.md | 8 ++ .../src/components/AppNav/AppNav.module.scss | 7 +- .../app/src/components/PageLayout.module.scss | 3 +- packages/app/styles/globals.css | 24 +++++- .../app/tests/e2e/core/mobile-nav.spec.ts | 73 +++++++++++++++++++ 5 files changed, 110 insertions(+), 5 deletions(-) create mode 100644 .changeset/mobile-nav-small-viewport.md create mode 100644 packages/app/tests/e2e/core/mobile-nav.spec.ts 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/src/components/AppNav/AppNav.module.scss b/packages/app/src/components/AppNav/AppNav.module.scss index 405444075..085c8328b 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, 100vh); + max-height: var(--app-viewport-height, 100vh); 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..d2e4d43e6 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, 100vh); } .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..cf6fb3d51 --- /dev/null +++ b/packages/app/tests/e2e/core/mobile-nav.spec.ts @@ -0,0 +1,73 @@ +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; + +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); +} + +test.describe('Mobile app nav', { tag: ['@core'] }, () => { + test.use({ viewport: LARGE_VIEWPORT, isMobile: true, hasTouch: true }); + + test('keeps the user menu on screen behind a browser toolbar', async ({ + page, + }) => { + const cdp = await page.context().newCDPSession(page); + await cdp.send('Emulation.setSmallViewportHeightDifferenceOverride', { + difference: SMALL_VIEWPORT_DIFFERENCE, + }); + + 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); + + await test.step('collapsed rail', async () => { + await expectUserMenuOnScreen(page, viewport.small); + }); + + await test.step('expanded overlay', async () => { + await page + .locator('button[aria-label="Collapse/expand navigation"]') + .click(); + await expectUserMenuOnScreen(page, viewport.small); + }); + }); +}); From 214a9a872be0e20470ce42f892da3a2bc12dbc98 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Wed, 18 Nov 2026 00:36:55 +0000 Subject: [PATCH 2/5] fix(app): size the search page root to the small viewport too The search page root was h="100vh", which matched the shell before this PR. With the shell on the small viewport it overflowed its scroll container by lvh - svh (81px on an iPhone 12), making the whole app scroll. Co-authored-by: Mike Shi --- packages/app/src/DBSearchPage.tsx | 2 +- .../app/tests/e2e/core/mobile-nav.spec.ts | 37 +++++++++++++++++-- 2 files changed, 34 insertions(+), 5 deletions(-) diff --git a/packages/app/src/DBSearchPage.tsx b/packages/app/src/DBSearchPage.tsx index 2a90cae9c..09ac6b6c1 100644 --- a/packages/app/src/DBSearchPage.tsx +++ b/packages/app/src/DBSearchPage.tsx @@ -2362,7 +2362,7 @@ function DBSearchPageContent() { return ( diff --git a/packages/app/tests/e2e/core/mobile-nav.spec.ts b/packages/app/tests/e2e/core/mobile-nav.spec.ts index cf6fb3d51..ea5e5fa31 100644 --- a/packages/app/tests/e2e/core/mobile-nav.spec.ts +++ b/packages/app/tests/e2e/core/mobile-nav.spec.ts @@ -15,6 +15,10 @@ const LARGE_VIEWPORT = { width: 390, height: 745 }; // 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) => { @@ -40,17 +44,19 @@ async function expectUserMenuOnScreen(page: Page, smallViewportHeight: number) { .toBeLessThanOrEqual(smallViewportHeight); } -test.describe('Mobile app nav', { tag: ['@core'] }, () => { +test.describe('Mobile app shell', { tag: ['@core'] }, () => { test.use({ viewport: LARGE_VIEWPORT, isMobile: true, hasTouch: true }); - test('keeps the user menu on screen behind a browser toolbar', async ({ - page, - }) => { + 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(); @@ -70,4 +76,27 @@ test.describe('Mobile app nav', { tag: ['@core'] }, () => { 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); + }); }); From c105b8fbf848d0aa7e583db07560eaf2ade9d899 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Wed, 18 Nov 2026 00:42:16 +0000 Subject: [PATCH 3/5] test(app): assert the mobile nav overlay actually opened A dropped toggle click would have re-measured the collapsed rail and passed. Also assert the user menu's top edge, so a nav collapsed to nothing or pushed off the top no longer satisfies the bottom-edge check on its own. Co-authored-by: Mike Shi --- packages/app/tests/e2e/core/mobile-nav.spec.ts | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/packages/app/tests/e2e/core/mobile-nav.spec.ts b/packages/app/tests/e2e/core/mobile-nav.spec.ts index ea5e5fa31..dedc2966a 100644 --- a/packages/app/tests/e2e/core/mobile-nav.spec.ts +++ b/packages/app/tests/e2e/core/mobile-nav.spec.ts @@ -42,6 +42,9 @@ async function expectUserMenuOnScreen(page: Page, smallViewportHeight: number) { 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'] }, () => { @@ -65,14 +68,19 @@ test.describe('Mobile app shell', { tag: ['@core'] }, () => { // 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 page - .locator('button[aria-label="Collapse/expand navigation"]') - .click(); + 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); }); }); From 0e7ae8dd6c261b1546a5b3c888b8c0aae5bfd3d9 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Wed, 18 Nov 2026 00:46:11 +0000 Subject: [PATCH 4/5] refactor(app): drop the unreachable var() fallbacks globals.css is imported in pages/_app.tsx and the Storybook preview, so --app-viewport-height is always defined wherever these styles render. The default belongs in globals.css alone. Co-authored-by: Mike Shi --- packages/app/src/DBSearchPage.tsx | 2 +- packages/app/src/components/AppNav/AppNav.module.scss | 4 ++-- packages/app/src/components/PageLayout.module.scss | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/app/src/DBSearchPage.tsx b/packages/app/src/DBSearchPage.tsx index 09ac6b6c1..a600e85af 100644 --- a/packages/app/src/DBSearchPage.tsx +++ b/packages/app/src/DBSearchPage.tsx @@ -2362,7 +2362,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 085c8328b..319a9690b 100644 --- a/packages/app/src/components/AppNav/AppNav.module.scss +++ b/packages/app/src/components/AppNav/AppNav.module.scss @@ -61,8 +61,8 @@ $transition-slow: 0.2s ease; // 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, 100vh); - max-height: var(--app-viewport-height, 100vh); + 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 d2e4d43e6..0cd2494ad 100644 --- a/packages/app/src/components/PageLayout.module.scss +++ b/packages/app/src/components/PageLayout.module.scss @@ -7,7 +7,7 @@ .fillViewport { // Same reason the app shell avoids 100vh — see styles/globals.css. - height: var(--app-viewport-height, 100vh); + height: var(--app-viewport-height); } .content { From e81a2aef96b7b581182a8604f33e6e6fdf6a75ad Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Wed, 18 Nov 2026 00:54:15 +0000 Subject: [PATCH 5/5] fix(app): size the trace redirect page to the small viewport too Last in-shell page root still on 100vh. Like the search page it matched the shell before this PR and overflowed its scroll container by lvh - svh after. Co-authored-by: Mike Shi --- packages/app/pages/trace/[traceId].tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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...