Skip to content

fix(header): move mobile navbar closer to the top of the viewport - #221

Merged
toto04 merged 1 commit into
mainfrom
itasimo/120
Nov 12, 2026
Merged

toto04 merged 1 commit into
mainfrom
itasimo/120

Conversation

@itasimo

@itasimo itasimo commented Nov 10, 2026

Copy link
Copy Markdown
Contributor

Closes #120

Problem

On mobile the navbar sat 56px below the top of the viewport, visibly lower than in the design.

The Figma mobile frames are full 402×874 device screens, so the navbar's y=56 includes the status bar and Dynamic Island. The code copied that as top-14, but a browser viewport already starts below the status bar, so the bar ended up about 40px too low.

Change

Only src/components/header/mobile-layout.tsx is touched.

  • The top offset is now a --nav-top variable instead of a fixed top-14:

    Viewport width Layout Top offset
    below 640px mobile 16px
    640–767px mobile 24px
    768–1023px mobile 32px
    1024px and up desktop 40px (unchanged)

    The 24px and 32px steps are not in Figma; they are there so the bar does not jump from 16px to the desktop's 40px at the breakpoint.

  • Each step is wrapped in max(…, env(safe-area-inset-top)), so the bar stays clear of the notch if the page is ever drawn under the status bar (installed as an app, or with viewport-fit=cover).

  • The open menu's max-height was hard-coded for the old offset (100dvh - 9rem). It now derives from --nav-top, so the open panel keeps the same gap at the bottom as at the top and scrolls inside when it does not fit.

Verification

Measured on a local dev server in Chrome, on /, /about, /join, /matricole and /groups:

  • Widths 320, 402, 639, 640, 767, 768, 1023, 1024 and 1440px: offsets as in the table, exactly one navbar visible at each width, no horizontal overflow.
  • Open menu at 800px, 500px and 480px viewport heights: bottom gap equals the top offset, content scrolls inside the panel.
  • No type errors in src; biome lint is clean on the changed file.

Not tested: a real iOS device, and the safe-area fallback (desktop Chrome reports a zero inset).

Note for review

Page content keeps its existing top padding, so the gap between the navbar and the first heading on mobile is about 40px larger than before. I left it alone because the issue is only about the navbar.

🤖 Generated with Claude Code

The Figma mobile frames are full device screens, so the navbar's 56px
offset includes the status bar. The browser viewport already starts
below it, which left the bar hanging about 40px too low.

Use a 16px offset that steps up to 24px and 32px on wider screens
before the desktop layout's 40px, falling back to the safe-area inset
when the page is drawn under the status bar. Size the open menu's max
height from the same offset so it keeps an equal gap at the bottom.

Closes #120

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@itasimo itasimo self-assigned this Nov 10, 2026
@coderabbitai

coderabbitai Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The mobile menu panel now uses a responsive, safe-area-aware top offset. Its maximum height calculation uses that offset instead of a fixed subtraction.

Changes

Mobile menu spacing

Layer / File(s) Summary
Responsive panel positioning and sizing
src/components/header/mobile-layout.tsx
The panel uses a safe-area-aware top offset with minimums of 1rem, 1.5rem at sm, and 2rem at md. Its maximum height subtracts twice the offset and 4.5rem from the dynamic viewport height.

Change: Bug fix

Merge Risk: Minimal · up to a8485

The menu uses a responsive top offset and derives its height from that offset. No merge-blocking issue is established.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title clearly describes the main change: moving the mobile navbar closer to the top of the viewport.
Linked Issues check Passed Issue #120 identifies the mobile navbar as too low. The PR summary reports responsive offsets of 16px, 24px, and 32px across mobile widths, replacing the 56px offset. The menu maximum height uses the …
Out of Scope Changes check Passed The reported changes are limited to the navbar position and the open menu height that depends on that position. The menu adjustment supports the issue objective. No unrelated changes are reported.
Docstring Coverage Passed No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Full details: Linked Issues check

Explanation

Issue #120 identifies the mobile navbar as too low. The PR summary reports responsive offsets of 16px, 24px, and 32px across mobile widths, replacing the 56px offset. The menu maximum height uses the same offset to preserve panel spacing. These changes address the linked issue.

Full details: Docstring Coverage

Explanation

No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 0 functions across 1 files.

Finishing Touches

Generate docstrings

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 8d2853a5-458f-4760-bb40-85b26b5cdf44
Commits

Reviewing files that changed from the base of the PR and between 7cecf20 and a84854b.

Files selected for processing: 1

  • src/components/header/mobile-layout.tsx

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

@toto04
toto04 merged commit 17f8c5b into main Nov 12, 2026
2 checks passed
@toto04
toto04 deleted the itasimo/120 branch November 12, 2026 17:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Navbar is hanging too low on mobile

2 participants