Repository navigation
fix(app): size the app shell to the small viewport on mobile - #3703
Conversation
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>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🦋 Changeset detectedLatest commit: 1a01f28 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
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 |
🔵 Tier 2 — Low RiskSmall, isolated change with no API route or data model modifications. Why this tier:
Review process: AI review + quick human skim (target: 5–15 min). Reviewer validates AI assessment and checks for domain-specific concerns. Stats
|
PR Review
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
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. |
Duplicate code analysisNo new duplicate code introduced by this PR. jscpd compared this branch against |
Deep ReviewScope: mobile viewport-sizing fix — a shared ✅ No critical issues found. 🟡 P2 — recommended
🔵 P3 nitpicks (2)
Reviewers (8): correctness, testing, maintainability, project-standards, agent-native, learnings-researcher, previous-comments, kieran-typescript. Testing gaps:
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 |
E2E Test Results✅ All tests passed • 473 passed • 1 skipped • 1059s
Tests ran across 4 shards in parallel. |
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>
|
Fixed in 214a9a8. The finding is correct, and this PR introduced it: Changed the root to Added a second case to Not changed, for scope: |
| // 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); |
There was a problem hiding this comment.
🔵 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
There was a problem hiding this comment.
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>
|
Deep Review: P2 fixed in c105b8f, replies to the nitpicks below. Note the review ran against the first commit, so its P3 on P2, overlay step could pass vacuously — correct, fixed. The step now asserts P3, P3, no browser guard on the CDP call — not adding one. P3, fallback convention differs between P3, page object pattern — not doing it here. P3, P3, other On the listed testing gaps: short/landscape viewports were verified manually during the fix (iPhone 12 landscape, 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. |
| <Flex | ||
| direction="column" | ||
| h="100vh" | ||
| h="var(--app-viewport-height, 100vh)" |
There was a problem hiding this comment.
🔵 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
There was a problem hiding this comment.
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>
|
I could not measure that page directly — it calls
Same 81px as the search page case I measured directly. I also confirmed A re-grep across the whole package shows no in-shell page roots left on On the remaining Deep Review P3s, unchanged from my previous reply: I am not adding landscape/banner E2E cases or a |
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 with100vh. Mobile browsers resolvevhagainst the large viewport, which includes the area behind the retractable browser toolbar, so the nav extended past the bottom of the screen. The nav isposition: fixedwhile the mobile overlay is open, and the overlay also setsbody { 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-heightcustom property, declared instyles/globals.csswith a100vhfallback for browsers withoutsvh.PageLayout'sfillViewportuses the same property so full-viewport pages stay flush with the shell.svhrather thandvh: the shell never scrolls the root document, so the toolbar never retracts andsvhis the steady-state height. That keeps the value constant and avoids reflowing the whole layout on a toolbar transition.Desktop is unaffected —
svh,lvhandvhare 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 (lvh745 /svh664), dark theme, nav overlay open. The dark strip at the bottom is the area the browser toolbar covers.Pixel 5 (
lvh851 /svh727):Desktop, unchanged:
Measured bottom edge of the user menu against the visible viewport, nav overlay open:
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
vhandsvhresolve to the same value there and the bug does not appear. Either use a physical device, or driveEmulation.setSmallViewportHeightDifferenceOverrideover CDP the waypackages/app/tests/e2e/core/mobile-nav.spec.tsdoes.On
main:/search.On this branch:
How to test on Vercel preview
Preview routes: /search
Steps:
/searchwith the browser emulating a phone viewport (e.g. 390x664).data-testid="user-menu-trigger") is visible at the bottom of the navigation, fully inside the viewport.References
Testing
packages/app/tests/e2e/core/mobile-nav.spec.tsemulates 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 assertssvh < lvhfirst, so it fails loudly rather than passing vacuously if the emulation stops working. Verified it fails onmain(menu bottom 731 vs a 666 visible viewport) and passes on this branch.make ci-lintequivalent for the touched package (nx run @hyperdx/app:ci:lint) andyarn ci:unitinpackages/app(5593 tests) both pass.next devserver in local mode.Fixes HDX-6067