Skip to content

fix: optimize hamburger menu performance on mobile#923

Merged
yamcodes merged 2 commits into
mainfrom
911-hamburger-menu-takes-a-second-to-load-on-mobile-1
May 10, 2026
Merged

fix: optimize hamburger menu performance on mobile#923
yamcodes merged 2 commits into
mainfrom
911-hamburger-menu-takes-a-second-to-load-on-mobile-1

Conversation

@yamcodes

@yamcodes yamcodes commented May 10, 2026

Copy link
Copy Markdown
Owner

Fixes #911.

Optimized the hamburger menu in the Header component by:

  1. Switching from conditional rendering to CSS visibility/opacity for the mobile dropdown. This avoids the React mount delay when clicking the menu button.
  2. Adding a smooth transition for both opacity and a slight vertical translation.
  3. Cleaning up unused imports in layout files.

Summary by CodeRabbit

  • Bug Fixes

    • Improved mobile menu rendering with smoother animations and transitions when opening and closing.
  • Refactor

    • Cleaned up unused imports across layout components.

Review Change Stack

@yamcodes yamcodes added bug Something isn't working www Improvements or additions to arkenv.js.org labels May 10, 2026
@yamcodes yamcodes linked an issue May 10, 2026 that may be closed by this pull request
@changeset-bot

changeset-bot Bot commented May 10, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 6494ed3

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

@github-actions github-actions Bot added the @arkenv/fumadocs-ui Issues or Pull Requests involving the ArkEnv Fumadocs UI theme label May 10, 2026
@arkenv-bot

arkenv-bot Bot commented May 10, 2026

Copy link
Copy Markdown
Contributor

🤖 Hi @yamcodes, I've received your request, and I'm working on it now! You can track my progress in the logs for more details.

@coderabbitai

coderabbitai Bot commented May 10, 2026

Copy link
Copy Markdown
Contributor

Warning

Rate limit exceeded

@yamcodes has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 54 minutes and 51 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 4a95d55b-bc73-430a-9090-6082e070db23

📥 Commits

Reviewing files that changed from the base of the PR and between 03a3437 and 6494ed3.

📒 Files selected for processing (1)
  • packages/fumadocs-ui/src/components/header.tsx

Walkthrough

Mobile menu overlay rendering is refactored to keep the DOM in place and use conditional Tailwind classes for state transitions, enabling smooth CSS animations. Layout imports are updated to use the refactored Header component and remove unused icon imports.

Changes

Mobile Menu Animation and Layout Updates

Layer / File(s) Summary
Mobile Menu Overlay Animation
packages/fumadocs-ui/src/components/header.tsx
Mobile dropdown overlay is changed from conditional render on mobileOpen to always-mounted when hasMobileMenu is true, with open/closed state controlled via conditional Tailwind classes (opacity, visibility, pointer-events, translate-y) to support transitions.
Layout Import Updates
apps/www/app/docs/layout.tsx, apps/www/app/(home)/layout.tsx
Docs layout imports Header from @arkenv/fumadocs-ui/components; home layout removes unused SiGithub import.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

  • yamcodes/arkenv#621: This PR removes the unused SiGithub imports that were previously added in the retrieved PR to apps/www layout files.

Poem

🐰 A smooth menu slides in without stutter,
Classes dance as states flutter,
Imports dance—keep what we need,
Transitions bloom at mobile speed! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title accurately summarizes the main change: optimizing hamburger menu performance on mobile by switching from conditional rendering to CSS visibility/opacity.
Linked Issues check ✅ Passed The pull request addresses the performance issue from #911 by implementing the stated optimization of switching from conditional rendering to CSS visibility/opacity for the mobile dropdown menu.
Out of Scope Changes check ✅ Passed All changes are within scope: header component optimization for mobile performance and removal of unused imports from layout files related to the fix.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch 911-hamburger-menu-takes-a-second-to-load-on-mobile-1

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 and usage tips.

@arkenv-bot

arkenv-bot Bot commented May 10, 2026

Copy link
Copy Markdown
Contributor

🤖 I'm sorry @yamcodes, but I was unable to process your request. Please see the logs for more details.

@pkg-pr-new

pkg-pr-new Bot commented May 10, 2026

Copy link
Copy Markdown

Open in StackBlitz

arkenv

npm i https://pkg.pr.new/arkenv@923

@arkenv/bun-plugin

npm i https://pkg.pr.new/@arkenv/bun-plugin@923

@arkenv/cli

npm i https://pkg.pr.new/@arkenv/cli@923

@arkenv/fumadocs-ui

npm i https://pkg.pr.new/@arkenv/fumadocs-ui@923

@arkenv/vite-plugin

npm i https://pkg.pr.new/@arkenv/vite-plugin@923

commit: 6494ed3

@arkenv-bot

arkenv-bot Bot commented May 10, 2026

Copy link
Copy Markdown
Contributor

📦 Bundle Size Report

No results found

All size limits passed!

@coderabbitai coderabbitai Bot left a comment

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.

🧹 Nitpick comments (1)
packages/fumadocs-ui/src/components/header.tsx (1)

156-159: ⚡ Quick win

Scope the transition properties instead of using transition-all

On Line 156, transition-all is broader than needed for this menu and can add avoidable work on mobile. Limit animation to opacity and transform for a tighter, more predictable transition path.

Suggested diff
- "md:hidden fixed inset-0 z-40 bg-fd-background flex flex-col px-4 py-6 transition-all duration-200 ease-out",
+ "md:hidden fixed inset-0 z-40 bg-fd-background flex flex-col px-4 py-6 transition-[opacity,transform] duration-200 ease-out",
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/fumadocs-ui/src/components/header.tsx` around lines 156 - 159, The
menu's CSS uses a broad "transition-all" which causes unnecessary work on
mobile; in packages/fumadocs-ui/src/components/header.tsx, locate the mobile
menu class string (the one combined with the mobileOpen conditional) and replace
the "transition-all" class with transition classes limited to opacity and
transform so only opacity and translate changes are animated (keep the same
duration/easing and the mobileOpen conditional logic intact).
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@packages/fumadocs-ui/src/components/header.tsx`:
- Around line 156-159: The menu's CSS uses a broad "transition-all" which causes
unnecessary work on mobile; in packages/fumadocs-ui/src/components/header.tsx,
locate the mobile menu class string (the one combined with the mobileOpen
conditional) and replace the "transition-all" class with transition classes
limited to opacity and transform so only opacity and translate changes are
animated (keep the same duration/easing and the mobileOpen conditional logic
intact).

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 61b4919a-f3e2-40dc-9e65-5f88b022027a

📥 Commits

Reviewing files that changed from the base of the PR and between 5e7ddcd and 03a3437.

📒 Files selected for processing (3)
  • apps/www/app/(home)/layout.tsx
  • apps/www/app/docs/layout.tsx
  • packages/fumadocs-ui/src/components/header.tsx
💤 Files with no reviewable changes (2)
  • apps/www/app/(home)/layout.tsx
  • apps/www/app/docs/layout.tsx

@arkenv-bot

arkenv-bot Bot commented May 10, 2026

Copy link
Copy Markdown
Contributor

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

Project Deployment Review Updated (Asia/Almaty)
arkenv Ready Ready Preview, Comment May 10 2026, 7:39 PM (Asia/Almaty)

@yamcodes
yamcodes merged commit fa6d5a7 into main May 10, 2026
18 checks passed
@yamcodes
yamcodes deleted the 911-hamburger-menu-takes-a-second-to-load-on-mobile-1 branch May 10, 2026 14:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

@arkenv/fumadocs-ui Issues or Pull Requests involving the ArkEnv Fumadocs UI theme bug Something isn't working www Improvements or additions to arkenv.js.org

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Hamburger menu takes a second to load on mobile

1 participant