Skip to content

fix(navbar): stop dropdown scroll-lock and keep navbar during lazy navigation - #91

Merged
creatorcluster merged 1 commit into
creatorcluster:mainfrom
Coder-soft:fix/navbar-dropdown
Oct 5, 2026
Merged

creatorcluster merged 1 commit into
creatorcluster:mainfrom
Coder-soft:fix/navbar-dropdown

Conversation

@Coder-soft

Copy link
Copy Markdown

Fixes issue Coder-soft#18

Summary

Two independent root causes made the navbar dropdowns feel broken.

1. Scroll lock hid the scrollbar and shifted the page (src/components/ui/dropdown-menu.tsx)

 const DropdownMenu = React.forwardRef((...)) =>
-  <DropdownMenuPrimitive.Root {...props}>
-    {props.open && <PreventLayoutShift />}   // measured <html>, but body is the scroller
+  <DropdownMenuPrimitive.Root modal={false} {...props}>
     {children}
   </DropdownMenuPrimitive.Root>

Radix Root defaulted to modal, so react-remove-scroll locked scrolling on body (the real scroll container) and removed its ~11px scrollbar with no compensation. The two custom "prevent layout shift" effects measured document.documentElement, whose innerWidth - clientWidth is 0 in this layout, so the guard never ran. Both effects are gone and the root now defaults to modal={false}.

2. Lazy navigation hid the navbar but not the portaled menu (src/App.tsx, pages)

 src/
 ├── App.tsx                     # one <Navbar/> rendered outside <Suspense>
-└── pages/*.tsx                # each page rendered its own <Navbar/>
+└── pages/*.tsx                # no per-page <Navbar/>
← always mounted, outside Suspense }> … lazy pages …

Every page rendered its own <Navbar/> inside the single top-level <Suspense>. Navigating to a not-yet-loaded chunk made React hide the previous subtree (navbar included) while the menu, portaled to document.body, escaped the hide and floated over the full-screen loader. A single global <Navbar/> now renders outside Suspense, and activeDropdown / drawer state resets on location.pathname changes.

Evidence

Measured in Chrome against vite dev, viewport 1280x800, with a space-taking scrollbar:

Before After
body scrollbar while dropdown open 11px → 0 stays 11px
getComputedStyle(body).overflowY hidden (scroll locked) auto
centered h1 center-x 671 → 676 (shift) stays 671

Lazy-navigation test (delayed route chunk): before, 400ms after clicking a dropdown link the header box collapsed to 0x0 while the menu was still 224x190 and visible over the Loading... fallback. After, the header stays 1280x72 during the load and the menu closes on navigation.

Checks: eslint . (0 errors), tsc --noEmit (clean), vite build (success).

Merge Danger

Door: two-way

Blast Radius: app-wide navigation shell

All routes now share one global navbar instead of a per-page instance. Layout is unchanged because the header is position: fixed and pages already reserve space for it. The dropdown-menu primitive is also used by the avatar menu and favorites sidebar, which now share the non-modal (no scroll-lock) behavior.

…vigation

Two root causes for issue #18:

1. DropdownMenu.Root defaulted to Radix `modal`, so react-remove-scroll
   locked `body` (the app's real scroll container) and removed the
   scrollbar without compensation, shifting the page. The custom
   PreventLayoutShift effects measured `document.documentElement` instead
   of the scroller, so their guard never ran. Remove the dead effects and
   default the root to `modal={false}`.

2. Every page rendered its own <Navbar/> inside the single top-level
   Suspense. Navigating to a lazy route hid the previous subtree
   (including the navbar) while the body-portaled dropdown escaped the
   hide and floated over the full-screen loading fallback. Render one
   global <Navbar/> outside Suspense, drop the per-page instances, and
   reset dropdown/drawer state on route change.
@vercel

vercel Bot commented Oct 4, 2026

Copy link
Copy Markdown

@Coder-soft is attempting to deploy a commit to the yamura3's projects Team on Vercel.

A member of the Team first needs to authorize it.

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Your trial has ended. Reactivate Greptile to resume code reviews.

@coderabbitai

coderabbitai Bot commented Oct 4, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 41 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: cc94d6d6-5bdc-4df9-935f-eaaeb1d2d4da
📥 Commits

Reviewing files that changed from the base of the PR and between b353f2b and 81b6bd9.

📒 Files selected for processing (37)
  • src/App.tsx
  • src/components/Navbar.tsx
  • src/components/ui/dropdown-menu.tsx
  • src/pages/Account.tsx
  • src/pages/Admin.tsx
  • src/pages/AiTitleHelper.tsx
  • src/pages/Analytics.tsx
  • src/pages/BackgroundGenerator.tsx
  • src/pages/BlogView.tsx
  • src/pages/Blogs.tsx
  • src/pages/Changelogs.tsx
  • src/pages/Community.tsx
  • src/pages/Construction.tsx
  • src/pages/Contact.tsx
  • src/pages/CreateCreatorPackPage.tsx
  • src/pages/CreatorPackPage.tsx
  • src/pages/EditCreatorPackPage.tsx
  • src/pages/FAQ.tsx
  • src/pages/Generators.tsx
  • src/pages/GuideView.tsx
  • src/pages/Guides.tsx
  • src/pages/Index.tsx
  • src/pages/LooneyResultPage.tsx
  • src/pages/ManageCreatorPacksPage.tsx
  • src/pages/MusicCopyright.tsx
  • src/pages/NativeApplication.tsx
  • src/pages/NotFound.tsx
  • src/pages/PlayerRenderer.tsx
  • src/pages/Privacy.tsx
  • src/pages/Profile.tsx
  • src/pages/Renderbot.tsx
  • src/pages/ResourcesHub.tsx
  • src/pages/Showcase.tsx
  • src/pages/TOS.tsx
  • src/pages/TextGenerator.tsx
  • src/pages/Utilities.tsx
  • src/pages/YouTubeDownloader.tsx
  • Autopilot · 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

Comment @coderabbitai help to get the list of available commands.

@creatorcluster
creatorcluster merged commit 9bdde13 into creatorcluster:main Oct 5, 2026
1 of 3 checks passed
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.

2 participants