Skip to content

fix(mobile): Fix broken mobile navigation menu#16832

Merged
rahulchhabria merged 8 commits intomasterfrom
fix/mobile-navigation
Mar 8, 2026
Merged

fix(mobile): Fix broken mobile navigation menu#16832
rahulchhabria merged 8 commits intomasterfrom
fix/mobile-navigation

Conversation

@rahulchhabria
Copy link
Contributor

The mobile navigation had several bugs that made it difficult to use on small screens.

Sidebar doesn't close after navigation — the sidebar toggle is CSS-only (a hidden checkbox + :has() selector). When a user tapped a nav link, the page navigated but the checkbox stayed checked, leaving the sidebar open over the new page content. Fixed by adding a CloseSidebarOnNavigation client component that watches usePathname and unchecks the checkbox on route change.

Header nav not full width — the <nav> inside the fixed header was missing w-full, so it only sized to its content width. This meant the ml-auto on the Menu button had nothing to push against, leaving it clipped instead of flush to the right edge.

Popover opens off-screen — the MobileMenu popover defaulted to align="center" relative to its trigger in the top-right corner, causing it to render partially off the left edge of the screen on narrow viewports. Changed to align="end" so it anchors to the right edge of the trigger.

Sidebar height overflow on mobile — the base .sidebar rule used height: 100vh but the sidebar starts at top: var(--header-height), so it overflowed 80px past the bottom of the screen on mobile (the corrected calc(100vh - var(--header-height)) was only applied inside a min-width: 768px media query). Moved the correct value to the base rule.

Invalid HTML<li> elements in MobileMenu had no <ul> parent, which is invalid HTML and can cause layout issues in some browsers.

Co-Authored-By: Claude noreply@anthropic.com

@vercel
Copy link

vercel bot commented Mar 7, 2026

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

Project Deployment Actions Updated (UTC)
develop-docs Ready Ready Preview, Comment Mar 7, 2026 9:26pm
sentry-docs Ready Ready Preview, Comment Mar 7, 2026 9:26pm

Request Review

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Autofix Details

Bugbot Autofix prepared a fix for the issue found in the latest run.

  • ✅ Fixed: Portal-rendered <ul> gets unstyled browser defaults
    • Added Tailwind classes list-none p-0 m-0 to the portal <ul> elements to override browser default margins/padding outside scoped preflight.

Create PR

Or push these changes by commenting:

@cursor push aae80af66d
Preview (aae80af66d)
diff --git a/src/components/mobileMenu/index.tsx b/src/components/mobileMenu/index.tsx
--- a/src/components/mobileMenu/index.tsx
+++ b/src/components/mobileMenu/index.tsx
@@ -37,14 +37,14 @@
           <Theme accentColor="iris">
             <Popover.Content className={styles.PopoverContent} sideOffset={5} align="end">
               <Box display={{xs: 'block', sm: 'none'}}>
-                <ul>
+                <ul className="list-none p-0 m-0">
                   <li className={styles.MenuItem}>
                     <Search path={pathname} searchPlatforms={searchPlatforms} />
                   </li>
                 </ul>
                 <div className={styles.MenuSeparator} />
               </Box>
-              <ul>
+              <ul className="list-none p-0 m-0">
                 <li className={styles.MenuItem}>
                   <Link href="https://sentry.io/changelog/">Changelog</Link>
                 </li>
This Bugbot Autofix run was free. To enable autofix for future PRs, go to the Cursor dashboard.

@rahulchhabria
Copy link
Contributor Author

@cursor push aae80af

rahulchhabria and others added 2 commits March 7, 2026 10:45
- Close sidebar on route change by unchecking the CSS toggle checkbox
  via a new CloseSidebarOnNavigation client component
- Fix sidebar height overflowing past viewport bottom on mobile
  (was 100vh, should exclude header height)
- Fix MobileMenu popover opening off-screen by adding align="end"
  so it anchors to the right edge of the trigger
- Fix invalid HTML: wrap orphan <li> elements in <ul> in MobileMenu
- Fix header nav not filling full width (missing w-full), which caused
  the Menu button to not be pushed to the right edge

Co-Authored-By: Claude <noreply@anthropic.com>
…browser defaults outside scoped preflight\n\nCo-Authored-By: Claude <noreply@anthropic.com>

Applied via @cursor push command
@rahulchhabria rahulchhabria force-pushed the fix/mobile-navigation branch from c32997e to 0f74550 Compare March 7, 2026 18:46
The /platforms sidebar was missing CloseSidebarOnNavigation, so the
mobile sidebar stayed open after navigating to a new page. All other
sidebar paths already had it.

Co-Authored-By: Claude <noreply@anthropic.com>
…sidebar toggle

Setting checkbox.checked = false does not fire a DOM change event,
so the Header's sidebarOpen state stayed true after navigation,
leaving the X icon visible even though the sidebar was closed.

Co-Authored-By: Claude <noreply@anthropic.com>
The base rule used 64px as the --header-height fallback but the
desktop media query still had 80px (leftover from the old header).
If --header-height were ever undefined, top and height would
disagree, causing 16px of overflow past the viewport bottom.

Co-Authored-By: Claude <noreply@anthropic.com>
…bile

When the sidebar is hidden (display:none on mobile), all child elements
have scrollHeight === 0, so findScrollContainer would escalate past .toc
and find <body> as the scroll container, causing the page to scroll to
the active link on navigation.

Guard both the click-handler and scroll-to-active paths against body/
documentElement so the effect is a no-op when the sidebar is not visible.

Co-Authored-By: Claude <noreply@anthropic.com>
The More button expands 5 links that fell outside the viewport with
no way to scroll to them. sidebar-external-links used flex: 0 0 auto
so it never scrolled, and the sidebar clips overflow with hidden.

Moving SidebarMoreLinks inside the .toc/.sidebar-main div means
expanding More just adds content to the existing scroll container.

Co-Authored-By: Claude <noreply@anthropic.com>
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

@rahulchhabria rahulchhabria merged commit 66e106a into master Mar 8, 2026
19 checks passed
@rahulchhabria rahulchhabria deleted the fix/mobile-navigation branch March 8, 2026 15:38
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.

3 participants