Skip to content

fix: improve navbar responsiveness on mobile devices#298

Open
Rohan-R07 wants to merge 3 commits into
Abhash-Chakraborty:mainfrom
Rohan-R07:fix-responsive-navbar
Open

fix: improve navbar responsiveness on mobile devices#298
Rohan-R07 wants to merge 3 commits into
Abhash-Chakraborty:mainfrom
Rohan-R07:fix-responsive-navbar

Conversation

@Rohan-R07
Copy link
Copy Markdown

@Rohan-R07 Rohan-R07 commented May 31, 2026

Summary

Improved the application's navigation experience across mobile, tablet, and desktop devices.

Previously, the navigation bar remained in a desktop-style layout on smaller screens, resulting in overflow issues, limited accessibility, and reduced usability. This update introduces a responsive navigation system with a dedicated hamburger menu and slide-out drawer for tablet and mobile devices while preserving the existing desktop experience.

The implementation also resolves horizontal overflow issues, improves viewport handling, and ensures navigation remains accessible across different screen sizes.

Fixes #296


Type of change

  • Bug fix

What changed

  • Added a responsive hamburger menu for tablet and mobile devices.
  • Implemented a slide-out navigation drawer for smaller screens.
  • Preserved the existing desktop navigation experience.
  • Improved navigation accessibility across multiple viewport sizes.
  • Fixed horizontal overflow and unwanted scrolling issues.
  • Resolved layout spacing issues caused by responsive navigation behavior.
  • Ensured the navigation drawer overlays content instead of affecting page layout.
  • Added proper drawer open/close interactions for a smoother mobile experience.
  • Maintained existing navigation routes, active state handling, theme toggle functionality, and Mock ML Mode behavior.

Screenshots / recordings (for UI changes)

BEFORE THE FIX

before

AFTER THE FIX

FInd second comit

How to test

  1. Clone the repository and run the project locally.

  2. Open the application in a browser.

  3. Use Developer Tools responsive mode or resize the browser window.

  4. Test common viewport sizes:

    • 320px
    • 375px
    • 425px
    • 768px
    • Desktop
  5. Verify that:

    • Desktop navigation remains unchanged.
    • A hamburger menu appears on tablet and mobile devices.
    • The navigation drawer opens and closes correctly.
    • Navigation items remain accessible and functional.
    • No horizontal scrolling occurs.
    • No major layout-breaking issues occur.
    • Theme toggle functionality remains intact.
    • Mock ML Mode behavior remains unchanged.

Checklist

  • I linked the related issue
  • I ran required checks from CONTRIBUTING.md
  • I updated docs/env notes if needed
  • My PR is scoped to a single issue
  • I followed commit message conventions
  • I am not committing secrets or local artifacts

GSSoC'26 Checklist

  • I requested issue assignment before starting
  • I have meaningful commits (no spam commits)
  • I am ready to explain my implementation in review comments

@github-actions
Copy link
Copy Markdown

PR Context Summary

Suggested issue links

  • No strong issue match found yet.

Use Fixes #123 or Closes #123 in the PR body when one of the suggestions is the intended issue.
Manual rerun: Actions > PR Context Triage > Run workflow > set pr_number and force_review=true.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 31, 2026

Review Change Stack

📝 Walkthrough

Walkthrough

Adds CSS to prevent horizontal overflow and a .hide-scrollbar utility; adjusts the root <nav> sizing; refactors NavBar to a responsive layout with a mobile drawer (portal), drawer open/close state, and handlers for route and Escape key to close the drawer.

Changes

Navigation Responsiveness Styling

Layer / File(s) Summary
CSS overflow constraints & scrollbar utility
frontend/src/app/globals.css
Prevent horizontal overflow on html, body, .page-shell, and .home-shell; change .container-shell width calc to calc(100% - 32px); add .hide-scrollbar utility with WebKit, Firefox, and legacy IE/Edge rules.
Root layout nav sizing
frontend/src/app/layout.tsx
Change <nav> Tailwind sizing from h-[var(--nav-height)] to min-h[...] h-auto, add w-full, max-w-full, and overflow-x-hidden while preserving sticky, border, and backdrop styles.
NavBar mobile drawer and responsive rendering
frontend/src/components/NavBar.tsx
Add createPortal drawer, isDrawerOpen state, auto-close on pathname/Escape, centralized navContent(isMobile) renderer, hamburger toggle for mobile, drawer content (links, mock-mode status, mobile theme toggle), and responsive theme toggle spacing.

Sequence Diagram

sequenceDiagram
  participant User
  participant NavBar
  participant Router
  participant DrawerPortal
  User->>NavBar: click hamburger / nav link
  NavBar->>DrawerPortal: open/close via isDrawerOpen
  Router->>NavBar: pathname change event
  NavBar->>NavBar: close drawer on pathname or Escape
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested labels

level:beginner, frontend, ui/ux, quality:clean

Suggested reviewers

  • Abhash-Chakraborty

Poem

🐰 I nudge the navbar, soft and small,
Hiding scrollbars behind the wall,
Drawer pops out when screens are tight,
Escape closes it, day or night,
Hopping on, the UI breathes light ✨

🚥 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
Title check ✅ Passed The title 'fix: improve navbar responsiveness on mobile devices' clearly and specifically describes the main change in the PR, which is improving mobile navbar responsiveness.
Linked Issues check ✅ Passed The PR successfully implements the primary objectives from issue #296: navbar now adapts to smaller screens via hamburger menu, navigation items remain accessible through drawer UI, overflow/layout issues reduced via CSS updates, and desktop functionality preserved.
Out of Scope Changes check ✅ Passed All changes are scoped to navbar responsiveness: CSS updates for layout constraints, NavBar component refactored for mobile drawer, and layout.tsx adjusted for nav height. No unrelated modifications detected.
Description check ✅ Passed The PR description is comprehensive and well-structured, following most of the template sections with detailed explanations, screenshots, testing instructions, and completed checklists.

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


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.

@macroscopeapp
Copy link
Copy Markdown
Contributor

macroscopeapp Bot commented May 31, 2026

Approvability

Verdict: Needs human review

Unable to check for correctness in 5a9add2. This PR introduces a new mobile navigation drawer feature rather than just CSS responsiveness fixes. Adding new interactive UI components with state management, keyboard handlers, and React portals represents new user-facing functionality that warrants human review.

You can customize Macroscope's approvability policy. Learn more.

@Rohan-R07
Copy link
Copy Markdown
Author

Hi, @Abhash-Chakraborty
please review my PR

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 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.

Inline comments:
In `@frontend/src/app/layout.tsx`:
- Around line 26-28: The nav currently uses h-auto while layout shells rely on
the CSS variable --nav-height, causing mismatch on small screens; update the nav
and the CSS variable to share one source of truth by making --nav-height
responsive (define it with media queries or Tailwind responsive utilities) and
use that variable for the nav height instead of h-auto (replace h-auto with
h-[var(--nav-height)] on the <nav> in layout.tsx and add breakpoint rules that
set --nav-height to the intended values so container-shell calculations remain
correct).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 1572884f-4360-4769-904c-0182f3c3cd73

📥 Commits

Reviewing files that changed from the base of the PR and between 20b306b and 9fc3306.

📒 Files selected for processing (3)
  • frontend/src/app/globals.css
  • frontend/src/app/layout.tsx
  • frontend/src/components/NavBar.tsx

Comment thread frontend/src/app/layout.tsx Outdated
@Abhash-Chakraborty
Copy link
Copy Markdown
Owner

@Rohan-R07 Can you add hamburger menu for smaller screen size

@Rohan-R07
Copy link
Copy Markdown
Author

Rohan-R07 commented May 31, 2026

Thanks for the feedback.

I will be implemented a hamburger menu for smaller screen sizes and I will be pushed the changes to this PR.

Please let me know if any further adjustments are needed.

@Abhash-Chakraborty Abhash-Chakraborty added the gssoc26 Related to GirlScript Summer of Code 2026. label May 31, 2026
@Abhash-Chakraborty
Copy link
Copy Markdown
Owner

Abhash-Chakraborty commented May 31, 2026

@Rohan-R07 where is the commit?

@Rohan-R07
Copy link
Copy Markdown
Author

Sorry it was a mistake I will be making the commit soon

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
frontend/src/components/NavBar.tsx (1)

203-221: ⚡ Quick win

Consider adding focus management and ARIA dialog semantics for accessibility.

The drawer lacks focus trap (users can tab to elements behind the overlay) and ARIA dialog semantics (role="dialog", aria-modal="true"). This affects keyboard and screen reader users.

♿ Suggested accessibility improvements
           {/* Mobile & Tablet Drawer Content */}
           <div
+            role="dialog"
+            aria-modal="true"
+            aria-label="Navigation menu"
             className={`fixed right-0 top-0 z-[70] h-full w-[280px] border-l border-[var(--frost)] bg-[color:var(--void)] p-6 shadow-2xl transition-all duration-300 ease-in-out lg:hidden ${
               isDrawerOpen ? "translate-x-0 visible" : "translate-x-full invisible pointer-events-none"
             }`}
           >

For full focus trapping, consider using a library like @radix-ui/react-dialog or adding a focus trap hook.

🤖 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 `@frontend/src/components/NavBar.tsx` around lines 203 - 221, The drawer markup
needs ARIA dialog semantics and focus management: when isDrawerOpen is true, add
role="dialog" and aria-modal="true" on the container and implement a focus trap
(or integrate a library such as `@radix-ui/react-dialog`) so tabbing cannot reach
elements behind the overlay; ensure keyboard support by closing on Escape
(handle in the same component using setIsDrawerOpen(false)), move initial focus
into the dialog (e.g., the close button) when opened, and restore focus to the
triggering element when closed; update the NavBar component to wire these
behaviors around the existing isDrawerOpen and setIsDrawerOpen logic.
🤖 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 `@frontend/src/components/NavBar.tsx`:
- Around line 203-221: The drawer markup needs ARIA dialog semantics and focus
management: when isDrawerOpen is true, add role="dialog" and aria-modal="true"
on the container and implement a focus trap (or integrate a library such as
`@radix-ui/react-dialog`) so tabbing cannot reach elements behind the overlay;
ensure keyboard support by closing on Escape (handle in the same component using
setIsDrawerOpen(false)), move initial focus into the dialog (e.g., the close
button) when opened, and restore focus to the triggering element when closed;
update the NavBar component to wire these behaviors around the existing
isDrawerOpen and setIsDrawerOpen logic.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 0883302e-dceb-4748-87e4-130d78a02425

📥 Commits

Reviewing files that changed from the base of the PR and between 9fc3306 and 5a9add2.

📒 Files selected for processing (3)
  • frontend/src/app/globals.css
  • frontend/src/app/layout.tsx
  • frontend/src/components/NavBar.tsx

@Rohan-R07
Copy link
Copy Markdown
Author

Rohan-R07 commented Jun 1, 2026

Hi, @Abhash-Chakraborty

I have implemented the hamburger menu.
Please review the PR and let me know if any further improvements are needed.

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gssoc26 Related to GirlScript Summer of Code 2026.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

good first issue: Responsive Navigation Bar on Smaller Screen Sizes

2 participants