Skip to content

fix(app): size the app shell to the small viewport on mobile - #3703

Merged
kodiakhq[bot] merged 6 commits into
mainfrom
cursor/fix-mobile-app-nav-bottom-section-c35a
Nov 18, 2026
Merged

kodiakhq[bot] merged 6 commits into
mainfrom
cursor/fix-mobile-app-nav-bottom-section-c35a

Conversation

@MikeShi42

Copy link
Copy Markdown
Contributor

Summary

On a phone the team switcher and user preferences at the bottom of the app nav could not be reached.

The app shell (.app-layout) and the nav (.nav) were both sized with 100vh. Mobile browsers resolve vh against the large viewport, which includes the area behind the retractable browser toolbar, so the nav extended past the bottom of the screen. The nav is position: fixed while the mobile overlay is open, and the overlay also sets body { overflow: hidden }, so nothing could scroll the bottom section into view. The collapsed rail had the same problem — its avatar was off screen too.

Both now size to the small viewport (the part that is always on screen) through a shared --app-viewport-height custom property, declared in styles/globals.css with a 100vh fallback for browsers without svh. PageLayout's fillViewport uses the same property so full-viewport pages stay flush with the shell.

svh rather than dvh: the shell never scrolls the root document, so the toolbar never retracts and svh is the steady-state height. That keeps the value constant and avoids reflowing the whole layout on a toolbar transition.

Desktop is unaffected — svh, lvh and vh are the same there, and the measured nav geometry at 1440x900 and 1280x520 is byte-identical before and after.

Screenshots or video

Mobile emulation with the browser toolbar simulated via Chromium's Emulation.setSmallViewportHeightDifferenceOverride, iPhone 12 (lvh 745 / svh 664), dark theme, nav overlay open. The dark strip at the bottom is the area the browser toolbar covers.

Before After
Before: nav bottom section off screen After: user menu visible above the toolbar

Pixel 5 (lvh 851 / svh 727):

Before After
Before: nav bottom section off screen After: user menu visible above the toolbar

Desktop, unchanged:

Before After
Desktop before Desktop after

Measured bottom edge of the user menu against the visible viewport, nav overlay open:

Profile visible viewport menu bottom before menu bottom after
iPhone 12 664 737 (off screen) 656
Pixel 5 727 843 (off screen) 719
iPhone 12 landscape 344 382 (off screen) 336
Desktop 1440x900 900 892 892

How to reproduce

Starting point: a real phone, or Chrome DevTools device emulation. Plain DevTools device emulation is not enough on its own — it does not simulate the retractable toolbar, so vh and svh resolve to the same value there and the bug does not appear. Either use a physical device, or drive Emulation.setSmallViewportHeightDifferenceOverride over CDP the way packages/app/tests/e2e/core/mobile-nav.spec.ts does.

On main:

  1. Open the app on a phone in portrait (iPhone Safari or Chrome on Android), on any page with the app nav, e.g. /search.
  2. The nav is a 50px icon rail. Note that the avatar at the bottom of the rail is not visible.
  3. Tap the panel icon in the top right of the rail to open the full nav.
  4. Scroll the nav to the bottom. The team switcher / user preferences row never appears — it sits behind the browser toolbar and the nav cannot scroll to it.

On this branch:

  1. Repeat the steps above. The avatar is visible at the bottom of the collapsed rail, and the team switcher / user preferences row is visible at the bottom of the open nav.
  2. Rotate to landscape and confirm the nav links scroll while the bottom row stays pinned on screen.
  3. On a desktop browser, confirm the nav is unchanged.

How to test on Vercel preview

Preview routes: /search

Steps:

  1. Open /search with the browser emulating a phone viewport (e.g. 390x664).
  2. Click the panel icon in the top-right corner of the icon rail to open the full navigation.
  3. Verify the user menu row (avatar plus name, data-testid="user-menu-trigger") is visible at the bottom of the navigation, fully inside the viewport.
  4. Click that row and confirm the menu with "User preferences" opens.
  5. Resize to a desktop viewport (e.g. 1440x900) and verify the navigation and its bottom user menu row look unchanged.

References

  • Linear Issue: HDX-6067
  • Related PRs:

Testing

  • New E2E test packages/app/tests/e2e/core/mobile-nav.spec.ts emulates a mobile browser toolbar over CDP and asserts the user menu stays within the small viewport in both the collapsed rail and the open overlay. It also asserts svh < lvh first, so it fails loudly rather than passing vacuously if the emulation stops working. Verified it fails on main (menu bottom 731 vs a 666 visible viewport) and passes on this branch.
  • make ci-lint equivalent for the touched package (nx run @hyperdx/app:ci:lint) and yarn ci:unit in packages/app (5593 tests) both pass.
  • The E2E suite as a whole was not run here: this VM has no Docker, so the ClickHouse/Mongo-backed runner cannot start. The new spec was run against a local next dev server in local mode.
Open in Web Open in Cursor 

Fixes HDX-6067

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 <mike@hyperdx.io>
@MikeShi42
MikeShi42 requested a review from a team as a code owner November 18, 2026 00:29
@vercel

vercel Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
hyperdx-oss Ready Ready Preview Nov 18, 2026 2:19am UTC
hyperdx-storybook Ready Ready Preview Nov 18, 2026 2:19am UTC

Request Review

@changeset-bot

changeset-bot Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 1a01f28

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@hyperdx/app Patch
@hyperdx/api Patch
@hyperdx/otel-collector Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions Bot added the review/tier-2 Low risk — AI review + quick human skim label Nov 18, 2026
@github-actions

github-actions Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

🔵 Tier 2 — Low Risk

Small, isolated change with no API route or data model modifications.

Why this tier:

  • Standard feature/fix — introduces new logic or modifies core functionality

Review process: AI review + quick human skim (target: 5–15 min). Reviewer validates AI assessment and checks for domain-specific concerns.
SLA: Resolve within 4 business hours.

Stats
  • Production files changed: 5
  • Production lines changed: 38 (+ 110 in test files, excluded from tier calculation)
  • Branch: cursor/fix-mobile-app-nav-bottom-section-c35a
  • Author: MikeShi42

To override this classification, remove the review/tier-2 label and apply a different review/tier-* label. Manual overrides are preserved on subsequent pushes.

@github-actions

github-actions Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

PR Review

If you are a coding agent acting for the author, read this first.
Nothing below blocks merge automatically; a maintainer decides. What they will expect:

  • 🔴 P0/P1 in code this PR adds or changes: fix before asking for review.
  • 🟡 P2 in code this PR changes: your call. Fix if small, otherwise reply.
  • 🔵 P3 is collapsed at the bottom: nobody needs to act on it before merge.
  • Anything about surrounding code, or asking you to widen the change (hoist a helper,
    dedupe with another file, fix other call sites): never fix here, whatever the
    priority. Reply with one sentence; if it is P0, say so plainly so a human sees it.

One commit per review round. After two rounds, stop and ask a maintainer to review
scope rather than addressing more automated findings. Full rule: AGENTS.md.

1 finding(s): 🔴 0 P0/P1 · 🟡 1 P2 · 🔵 0 P3

None could be anchored to changed lines; they are listed below.

Findings outside the changed lines

  • 🟡 P2 packages/app/src/components/DashboardTableOfContents.tsx:56 — Dashboard table of contents still sized with 100vh inside the svh shell, so its bottom sits behind the mobile toolbar → This file is outside the diff. The sticky TOC lives in the app shell's scroll container (#app-content-scroll-container, src/layout.tsx) and has overflow: hidden. Its maxHeight: calc(100vh - …) still uses the large viewport, so on a phone its last rows end up behind the toolbar, which is the same problem this PR fixes for .nav. Change it to calc(var(--app-viewport-height) - var(--mantine-spacing-sm) * 2) so every shell-relative height uses the new token.

Priority comes from a separate grading pass over the finished review. P3 is folded here instead of posted inline. No finding blocks merge automatically; a maintainer decides.

@github-actions

github-actions Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Duplicate code analysis

No new duplicate code introduced by this PR.


jscpd compared this branch against origin/main
across app, api and common-utils. Only new clones are listed; the codebase
currently holds 106 in total (1.14%).
Run yarn dupes locally to reproduce, or yarn dupes:all for the full picture.

@github-actions

github-actions Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Deep Review

Scope: mobile viewport-sizing fix — a shared --app-viewport-height custom property (100vh fallback, 100svh via @supports) replaces hardcoded 100vh in the app shell, nav, PageLayout.fillViewport, DBSearchPage root, and TraceRedirectPage root, plus a new CDP-driven E2E spec. The substitution is clean: the property is defined on :root in globals.css, which loads in every layout context (_app.tsx, Storybook preview.tsx), so consumers lacking an inline fallback never resolve to auto. All prior-round feedback was verified addressed in the current tree.

✅ No critical issues found.

🟡 P2 — recommended

  • packages/app/styles/globals.css:60 — the .app-layout-with-banner grid branch was modified to use var(--app-viewport-height) but has no E2E coverage; both tests exercise only the no-banner .app-layout path (the banner needs IS_CLICKHOUSE_BUILD plus an opened banner state), leaving nav reachability with the banner active unverified.
    • Fix: Add a mobile-nav case with the banner active that asserts the user menu stays within the small viewport, or record the banner branch as an explicit documented residual-risk if coverage is deferred.
    • testing, correctness
🔵 P3 nitpicks (2)
  • packages/app/tests/e2e/core/mobile-nav.spec.ts:37 — the spec uses raw page.locator() directly, which the e2e README's Page Object Pattern forbids, though core/navigation.spec.ts sets the same in-directory precedent.
    • Fix: Move the nav, user-menu, and search-page locators into a page object or component helper and call those from the spec.
  • agent_docs/page_layout.md:60 (pre-existing, untouched file) — still documents fillViewport as height: 100vh, which now contradicts the implementation and re-teaches the exact bug this PR fixes.
    • Fix: Update the fillViewport description to reference var(--app-viewport-height).
    • maintainability, previous-comments

Reviewers (8): correctness, testing, maintainability, project-standards, agent-native, learnings-researcher, previous-comments, kieran-typescript.

Testing gaps:

  • No coverage of the @supports (height: 100svh) fallback branch — Chromium always satisfies it, so the 100vh fallback path ships unexercised.
  • Only portrait 390x745 is tested; landscape small-viewport behavior (where off-screen-nav regressions are most visible) is uncovered.
  • .app-layout-with-banner branch is untested (see P2).

No finding blocks merge automatically. A maintainer will expect P0/P1 findings in code this PR changes to be fixed; P2/P3 are your call -- fix or reply. Never fix findings about surrounding code here; reply instead. Do not widen the PR. How to respond

@github-actions

github-actions Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

E2E Test Results

✅ All tests passed • 473 passed • 1 skipped • 1059s

Status Count
✅ Passed 473
❌ Failed 0
⚠️ Flaky 4
⏭️ Skipped 1

Tests ran across 4 shards in parallel.

View full report →

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 <mike@hyperdx.io>
@cursor

cursor Bot commented Nov 18, 2026

Copy link
Copy Markdown

Fixed in 214a9a8.

The finding is correct, and this PR introduced it: DBSearchPage's root matched the shell when both were 100vh, and moving the shell to the small viewport left the page 81px taller than its scroll container on an iPhone 12 profile. Measured on the previous commit at lvh 745 / svh 664: #app-content-scroll-container had clientHeight 664 and scrollHeight 745. It is now 664/664.

Changed the root to h="var(--app-viewport-height, 100vh)" rather than h="100%", so it uses the same property as the rest of the PR and does not depend on the flex chain producing a definite height.

Added a second case to mobile-nav.spec.ts asserting the content scroll container does not overflow under the same toolbar emulation. It fails on the previous commit (80px of overflow) and passes now.

Not changed, for scope: PodDetailsSidePanel (styles.body.height: '100vh') and FullscreenPanelModal (calc(100vh - 80px)) are portal-rendered overlays outside the app shell, so their bottoms were already behind the mobile toolbar before this PR and are unaffected by it.

// 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);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 minor — The 100vh fallback inside var() can never apply

--app-viewport-height is always defined on :root: styles/globals.css sets it to 100vh and overrides it to 100svh behind @supports. That file is imported app-wide in pages/_app.tsx and in Storybook. So the , 100vh fallback here, in PageLayout.module.scss:10 and in DBSearchPage.tsx:2365 never takes effect, and globals.css itself uses the property without one. Drop the fallbacks so globals.css is the only place the default is defined.

Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right, and my earlier reply on this was wrong — I claimed the fallback covered Storybook, but .storybook/preview.tsx:15 imports globals.css, so the property is defined there too. Along with pages/_app.tsx:32 that covers every context where these styles are laid out; Jest maps CSS to identity-obj-proxy and computes no layout, so it doesn't need the fallback either.

Dropped all three in 0e7ae8d, so globals.css is the only place the default lives. Tests still pass.

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 <mike@hyperdx.io>
@cursor

cursor Bot commented Nov 18, 2026

Copy link
Copy Markdown

Deep Review: P2 fixed in c105b8f, replies to the nitpicks below. Note the review ran against the first commit, so its P3 on DBSearchPage.tsx:2365 was already addressed in 214a9a8.

P2, overlay step could pass vacuously — correct, fixed. The step now asserts aria-expanded is false in the rail and true after the click, so a dropped click fails instead of silently re-measuring the collapsed layout.

P3, expectUserMenuOnScreen only checks the bottom edge — fair, folded into the same commit: it now also asserts box.y >= 0, so a nav collapsed to nothing or pushed off the top no longer satisfies it.

P3, no browser guard on the CDP call — not adding one. playwright.config.ts defines a single chromium project, and a test.skip guarding a project that does not exist is dead code today; whoever adds a webkit/firefox project will hit this and many other Chromium-only specs at once.

P3, fallback convention differs between globals.css and the SCSS/TSX consumers — intentional, leaving as is. The :root declaration lives in globals.css, so a var(..., 100vh) fallback two lines below it is noise. The other consumers are in separate files that can render without globals.css loaded (Storybook, component tests), which is exactly what the fallback is for.

P3, page object pattern — not doing it here. tests/e2e/core/ consistently uses raw locators (navigation.spec.ts does the same for these very elements); introducing an AppNav page object means rewriting that file too, which is scope this PR should not take on.

P3, expect.poll could settle on an intermediate transition frame — does not apply to what is measured. The only animated property in play is the nav's width (transition: width 0.2s ease); nothing transitions the nav's height or the user menu's vertical position, so the y coordinate is settled on the first frame after the state change.

P3, other 100vh surfaces — PodDetailsSidePanel and FullscreenPanelModal are portal-rendered overlays outside the app shell and pre-date this PR, as noted above. Agreed they are worth a follow-up.

On the listed testing gaps: short/landscape viewports were verified manually during the fix (iPhone 12 landscape, lvh 390 / svh 344 — the nav links scroll while the user menu stays on screen at 300–336), but I did not add them as cases. The @supports fallback and the .app-layout-with-banner branch are not covered.

That is two rounds of automated findings, so I am stopping here rather than growing the PR further — a maintainer should weigh the remaining nitpicks against scope.

Comment thread packages/app/src/DBSearchPage.tsx Outdated
<Flex
direction="column"
h="100vh"
h="var(--app-viewport-height, 100vh)"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 minor — The 100vh fallback in var(--app-viewport-height, 100vh) can never be used

styles/globals.css always sets --app-viewport-height on :root (100vh, then 100svh under @supports), and pages/_app.tsx imports it globally, so the fallback here and in AppNav.module.scss and PageLayout.module.scss never applies. It also spreads the fallback across four places, while .app-layout in globals.css uses the bare var(). Use the bare var(--app-viewport-height) everywhere so there is one source of truth.

Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Already done — dropped in 0e7ae8d, which landed just before this review round ran. All four consumers now use the bare var(--app-viewport-height).

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 <mike@hyperdx.io>
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 <mike@hyperdx.io>
@cursor

cursor Bot commented Nov 18, 2026

Copy link
Copy Markdown

deep-review CI failure is not from this PR. The job died in its own harness: --json-schema was provided but Claude did not return structured_output, in the "Run deep review" step, with the "Extract review from structured output" and "Post or update deep review" steps never reaching completion. It had already posted its review body. Nothing in the diff is implicated, and every other check is green.

pages/trace/[traceId].tsx — fixed in e81a2ae. The Claude review was right that this is the same defect as the search page root, and my 100vh grep missed it because I only searched src/, not pages/. TraceRedirectPage uses withAppNav and rendered <Center h="100vh"> inside #app-content-scroll-container, so after this PR it was 81px taller than the svh shell on an iPhone 12 profile. Now h="var(--app-viewport-height)".

I could not measure that page directly — it calls router.replace on mount, and my first two attempts at pinning it down were measuring the search page after the client router had already swapped components, which is why the numbers looked identical with and without the fix. Rather than keep contriving a harness for a page that exists for one frame, I verified the mechanism on an isolated reproduction of the same DOM and CSS (.app-layout at --app-viewport-height, flex row, overflow-y: scroll child, page root at the height under test):

page root height page root scroller client scroller scroll overflow
100vh 1872 1791 1872 81
var(--app-viewport-height) 1791 1791 1791 0

Same 81px as the search page case I measured directly. I also confirmed /trace/abc123 still redirects to /search?traceId=abc123.

A re-grep across the whole package shows no in-shell page roots left on 100vh. What remains is out of scope and pre-existing: PodDetailsSidePanel and FullscreenPanelModal (portal overlays outside the shell), DashboardTableOfContents (a max-height cap), LatencyTab (calc(100vh - 240px) chart sizing), and the h-100/vh-100 Bootstrap utility classes.

On the remaining Deep Review P3s, unchanged from my previous reply: I am not adding landscape/banner E2E cases or a data-testid for the collapse control in this PR. One correction though — agent_docs/page_layout.md documenting fillViewport as height: 100vh is a fair catch, but it is a doc file this PR has not touched, so I am leaving it for a maintainer to decide rather than widening the diff.

@kodiakhq
kodiakhq Bot merged commit 3419ab0 into main Nov 18, 2026
28 checks passed
@kodiakhq
kodiakhq Bot deleted the cursor/fix-mobile-app-nav-bottom-section-c35a branch November 18, 2026 02:24

This branch was successfully deployed

2 active deployments
Preview – hyperdx-oss — 1a01f281 Deployed Nov 18, 2026 by vercel[bot]
Preview – hyperdx-storybook — 1a01f281 Deployed Nov 18, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automerge review/tier-2 Low risk — AI review + quick human skim

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants