Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Sep 8, 2025

The mobile hamburger menu was not functioning properly on mobile devices because the navigation sidebar was positioned outside the viewport due to incorrect CSS transform values. Additionally, the menu was sliding in from the wrong direction, creating a poor user experience.

Problem

When users clicked the hamburger menu button (☰) on mobile devices, the menu appeared to do nothing. Upon investigation, the sidebar was actually being rendered but positioned completely off-screen to the right of the viewport, making it invisible to users. After fixing the initial positioning issue, the menu was sliding in from the left, which felt unnatural since the hamburger button is positioned on the right side.

Root Cause

The issue was in src/scss/main.scss where the .navbar-sidebar had a CSS transform that positioned it 100% to the right:

.navbar-sidebar {
  left: inherit;
  right: 0;
  transform: translate3d(100%, 0, 0);  /* This pushed it outside viewport */
}

This transform was interfering with Docusaurus's built-in mobile navigation positioning and animation system.

Solution

Updated the CSS to properly handle both the hidden and visible states of the mobile menu:

  1. Hidden state: Menu positioned off-screen to the right with transform: translate3d(100%, 0, 0)
  2. Visible state: Menu slides in from the right with transform: translate3d(0, 0, 0) when .navbar-sidebar--show class is applied
.navbar-sidebar {
  left: inherit;
  right: 0;
  transform: translate3d(100%, 0, 0);
}

.navbar-sidebar--show .navbar-sidebar {
  transform: translate3d(0, 0, 0);
}

This creates a natural slide-in animation from the right side, matching the hamburger button position.

Testing

  • ✅ Verified hamburger menu opens and closes correctly on mobile
  • ✅ Confirmed menu slides in from the right side as expected
  • ✅ Tested across multiple mobile screen sizes (375px, 414px)
  • ✅ Confirmed sidebar is properly positioned within viewport when open
  • ✅ Smooth animation transitions work correctly
  • ✅ Build process remains unaffected

Mobile menu sliding from right

The mobile hamburger menu now works as expected with improved UX across all mobile devices!

Fixes #710.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copy link
Contributor Author

Copilot AI commented Sep 8, 2025

@ccamel 👋 This repository doesn't have Copilot instructions. With Copilot instructions, I can understand the repository better, work faster and produce higher quality PRs.

I can generate a .github/copilot-instructions.md file for you automatically. Click here to open a pre-filled issue and assign it to me. I'll write the instructions, and then tag you for review.

@vercel
Copy link

vercel bot commented Sep 8, 2025

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

Project Deployment Preview Comments Updated (UTC)
docs Ready Ready Preview Comment Sep 10, 2025 5:26pm

Remove problematic transform from navbar-sidebar CSS that was causing the mobile menu to be positioned outside the viewport. The custom transform: translate3d(100%, 0, 0) was preventing the sidebar from being visible when opened on mobile devices.

Co-authored-by: ccamel <9574336+ccamel@users.noreply.github.com>
Copilot AI changed the title [WIP] Mobile hamburger menu not opening Fix mobile hamburger menu not opening due to CSS positioning issue Sep 8, 2025
Copilot AI requested a review from ccamel September 8, 2025 09:32
@ccamel
Copy link
Member

ccamel commented Sep 10, 2025

@copilot Looks good and the menu shows up now 👍 But, AFAIS right now it slides in from the left, which feels off since the burger is on the right. UX-wise we can't ship it like this though, the menu needs to slide in from the right, not the left.

Can you adjust the hidden state/transform so it behaves accordingly?
Thanks! 🙏

Adjust CSS to make mobile menu slide in from the right instead of left, providing better UX since the hamburger button is positioned on the right side. The menu now properly slides from the right edge of the screen when opened.

Co-authored-by: ccamel <9574336+ccamel@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Sep 10, 2025

@copilot Looks good and the menu shows up now 👍 But, AFAIS right now it slides in from the left, which feels off since the burger is on the right. UX-wise we can't ship it like this though, the men...

Fixed! The mobile menu now slides in from the right side as expected, matching the hamburger button position. The CSS has been updated to use transform: translate3d(100%, 0, 0) for the hidden state and transform: translate3d(0, 0, 0) for the open state, creating the proper right-to-left slide animation.

Mobile menu sliding from right

Changes in commit 800345a.

Copilot AI changed the title Fix mobile hamburger menu not opening due to CSS positioning issue Fix mobile hamburger menu positioning and slide animation direction Sep 10, 2025
Copy link
Member

@ccamel ccamel left a comment

Choose a reason for hiding this comment

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

Excellent! Thanks ❤️

@ccamel ccamel marked this pull request as ready for review September 11, 2025 12:34
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 11, 2025

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


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

Copy link
Member

@bot-anik bot-anik left a comment

Choose a reason for hiding this comment

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

Device URL
desktop http://localhost:3000/

Device URL
mobile http://localhost:3000/

Not what you expected? Are your scores flaky? GitHub runners could be the cause.
Try running on Foo instead

@ccamel ccamel merged commit 99126cb into main Sep 11, 2025
17 of 18 checks passed
@ccamel ccamel deleted the copilot/fix-710 branch September 11, 2025 12:39
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.

Mobile hamburger menu not opening

3 participants