Skip to content

Enhance navbar hover effects and interactions#752

Open
tanvi1107 wants to merge 2 commits into
knoxiboy:mainfrom
tanvi1107:improve-navbar-hover-effects
Open

Enhance navbar hover effects and interactions#752
tanvi1107 wants to merge 2 commits into
knoxiboy:mainfrom
tanvi1107:improve-navbar-hover-effects

Conversation

@tanvi1107

@tanvi1107 tanvi1107 commented Jul 3, 2026

Copy link
Copy Markdown

User description

Description

Enhanced the navigation bar by improving hover interactions and visual feedback. Added smooth hover animations to navigation items to create a more modern and engaging user experience while keeping the existing functionality unchanged.

Related Issue

Closes #738

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Documentation update (README, guides, comments)
  • Style / UI change (no logic change)
  • Code refactor (no behavior change)
  • Test addition or update
  • Breaking change (fix or feature that would cause existing functionality to change)

Screenshots (if UI change)

Before After
(Add before screenshot) (Add after screenshot)

How Has This Been Tested?

  • Tested locally with npm run dev
  • Verified on mobile viewport (375px)
  • Verified on desktop viewport (1440px)

Checklist

  • I have tested my changes locally (npm run dev)
  • My code follows the existing code style (TypeScript, Tailwind, no any types)
  • I have not introduced unrelated changes (each PR should address one issue)
  • I have added comments where necessary
  • My branch is up to date with main
  • I have linked the related issue above
  • Screenshots are included (if this is a UI change)

Summary by CodeRabbit

  • New Features
    • Enhanced the mobile navigation menu with improved open/close behavior, including automatic closing when switching pages.
    • Added keyboard support to close the mobile menu with the Escape key.
  • Bug Fixes
    • Locked background page scrolling while the mobile menu is open.
    • Improved active-link highlighting across both desktop and mobile navigation.
    • Refined focus and accessibility styling (including clearer focus rings and aria-current state).

CodeAnt-AI Description

Improve header navigation clarity and mobile menu behavior

What Changed

  • The header now shows clear active states for the current page on desktop and mobile, including the new About link
  • The mobile menu now closes when you press Escape, when you navigate to another page, and it prevents the page from scrolling while open
  • Header actions now show visible focus outlines, and the logo uses cleaner image handling for sharper display
  • The scroll indicator now uses a more noticeable gradient

Impact

✅ Easier navigation on desktop and mobile
✅ Fewer stuck mobile menus
✅ Clearer keyboard access to header actions

💡 Usage Guide

Checking Your Pull Request

Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.

Talking to CodeAnt AI

Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

Preserve Org Learnings with CodeAnt

You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

Check Your Repository Health

To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.

@vercel

vercel Bot commented Jul 3, 2026

Copy link
Copy Markdown

@tanvi1107 is attempting to deploy a commit to the Karan Mani Tripathi 's projects Team on Vercel.

A member of the Team first needs to authorize it.

@codeant-ai

codeant-ai Bot commented Jul 3, 2026

Copy link
Copy Markdown

CodeAnt AI is reviewing your PR.

@codeant-ai

codeant-ai Bot commented Jul 3, 2026

Copy link
Copy Markdown

Thanks for using CodeAnt! 🎉

We're free for open-source projects. if you're enjoying it, help us grow by sharing.

Share on X ·
Reddit ·
LinkedIn

@github-actions github-actions Bot added gssoc'26 GSSoC program issue level:beginner Beginner level task type:bug Bug fix type:docs Documentation update need-star labels Jul 3, 2026

@github-actions github-actions 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.

Hello there! 🎉 Thank you so much for your first pull request to DoubtDesk!

We really appreciate your contribution. A maintainer will review your code soon. If you are participating in GSSoC, ensure your PR is linked to an open issue. Please make sure you have followed all rules in our Contributing Guidelines. Happy coding!

@github-actions github-actions 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.

⭐ Star Required

Hi @tanvi1107! Thank you for your contribution to DoubtDesk.

Before we can complete the review and merge this pull request, please star the DoubtDesk repository.

Once you have starred the repository, please drop a comment here saying "done" and we will proceed with reviewing your PR. Thank you!

@github-actions github-actions Bot requested a review from knoxiboy July 3, 2026 08:47
@github-actions

github-actions Bot commented Jul 3, 2026

Copy link
Copy Markdown

@coderabbitai review

@codeant-ai codeant-ai Bot added the size:L This PR changes 100-499 lines, ignoring generated files label Jul 3, 2026
@github-actions github-actions Bot added size/l and removed size:L This PR changes 100-499 lines, ignoring generated files size/m labels Jul 3, 2026
@coderabbitai

coderabbitai Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

Header.tsx now locks body scrolling while the mobile menu is open, closes it on Escape or route changes, and applies active-state, ARIA, and focus-visible styling across the desktop and mobile navigation, logo, and authenticated links.

Changes

Header navigation UX/accessibility refactor

Layer / File(s) Summary
Imports and mobile-menu state effects
src/components/Header.tsx
Adds next/image and useCallback imports; adds useEffect hooks to lock body scroll while the mobile menu is open, close it on Escape, and close it on route changes.
Active-route detection helper
src/components/Header.tsx
Extends pageLinks and introduces a memoized isActive helper via useCallback for determining active routes.
Desktop navigation and logo styling
src/components/Header.tsx
Refactors the logo to use next/image, updates the back button, and reworks desktop nav with aria-label, active underline styling, aria-current, focus-visible classes, and updated authenticated nav item (Dashboard/Admin/Profile) and role badge styling.
Mobile menu markup and controls
src/components/Header.tsx
Updates the mobile toggle button (aria-expanded, aria-controls), progress bar and panel transform behavior, mobile back button, nav container, scroll/non-scroll links, Dashboard/Admin links, and Sign In/Join buttons with aria-current and focus-visible styling.

Estimated code review effort: 2 (Simple) | ~15 minutes

Possibly related PRs

  • knoxiboy/DoubtDesk#445: Both PRs modify src/components/Header.tsx’s mobile navigation overlay behavior and close/toggle logic.
  • knoxiboy/DoubtDesk#724: Both PRs touch Header.tsx mobile menu toggling, ARIA state, and responsive header behavior.
  • knoxiboy/DoubtDesk#758: Both PRs update Header.tsx responsive navigation rendering and mobile/desktop breakpoint behavior.

Suggested labels: type:design

Suggested reviewers: knoxiboy

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The header changes add hover/active states, responsiveness, ARIA/focus support, and mobile menu behavior aligned with #738.
Out of Scope Changes check ✅ Passed All changes stay within the header/navbar UI and interaction updates described in the linked issue.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the main navbar UI and interaction improvements, including hover effects and mobile/menu behavior.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@tanvi1107

Copy link
Copy Markdown
Author

Hi @knoxiboy ! I've implemented the requested navbar hover effect improvements and verified the changes locally. I'd appreciate it if you could review the PR and merge it if everything looks good. Thank you!

@codeant-ai

codeant-ai Bot commented Jul 3, 2026

Copy link
Copy Markdown

CodeAnt AI finished reviewing your PR.

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

Actionable comments posted: 2

🧹 Nitpick comments (2)
src/components/Header.tsx (2)

87-90: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

isActive only exact-matches paths — nested routes won't highlight.

pathname === href won't mark /dashboard active when the user is on /dashboard/settings or similar sub-routes. Given the linked issue calls for "clear active-page highlighting," consider prefix matching for non-root paths.

♻️ Possible refactor
   const isActive = useCallback(
-    (href: string) => !href.startsWith("#") && pathname === href,
+    (href: string) =>
+      !href.startsWith("#") &&
+      (pathname === href || pathname.startsWith(`${href}/`)),
     [pathname]
   );
🤖 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 `@src/components/Header.tsx` around lines 87 - 90, The Header.tsx isActive
helper only checks exact pathname matches, so nested routes under the same
section won’t stay highlighted. Update the useCallback-based isActive logic to
do prefix matching for non-root, non-hash links while preserving the root path
behavior, and keep using pathname plus href inside the Header component to
locate the change.

148-148: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

New aria-label/id strings are hardcoded inline.

"Primary navigation", "Toggle navigation menu", "mobile-nav-panel", "Mobile navigation" are all new literal strings. Per path instructions for .tsx files, prefer extracting user-facing/ARIA strings to shared constants for consistency and easier i18n later.

Also applies to: 258-260, 277-277, 308-308

🤖 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 `@src/components/Header.tsx` at line 148, The new ARIA labels and DOM id
strings in Header are hardcoded inline, so move the literals used by the
navigation controls into shared constants instead of embedding them directly in
the JSX. Update the relevant Header.tsx elements referenced by aria-label and
id, including the navigation menu toggle and mobile panel, and reuse the
extracted constants anywhere those strings appear so the naming stays consistent
and is easier to localize later.

Source: Path instructions

🤖 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 `@src/components/Header.tsx`:
- Around line 221-234: Admin and Profile nav items in Header should use the same
active-state pattern as Dashboard, including aria-current and conditional
active/inactive styling. Update the Header component’s desktop and mobile link
rendering so Admin and Profile derive their active state from the current route
(via the same isActive logic used for Dashboard) and apply matching classes when
active. Keep the existing Link structure, but ensure all authenticated nav links
expose consistent current-page semantics and visual highlighting.
- Around line 276-282: Keep the closed mobile nav out of keyboard focus by
ensuring the `#mobile-nav-panel` in Header.tsx is truly inactive when isOpen is
false. Update the mobile nav container logic so its interactive descendants are
not tabbable while closed, either by adding inert to the panel or by
conditionally disabling/removing focusable children in the same Header component
where isOpen controls aria-hidden and the transform classes.

---

Nitpick comments:
In `@src/components/Header.tsx`:
- Around line 87-90: The Header.tsx isActive helper only checks exact pathname
matches, so nested routes under the same section won’t stay highlighted. Update
the useCallback-based isActive logic to do prefix matching for non-root,
non-hash links while preserving the root path behavior, and keep using pathname
plus href inside the Header component to locate the change.
- Line 148: The new ARIA labels and DOM id strings in Header are hardcoded
inline, so move the literals used by the navigation controls into shared
constants instead of embedding them directly in the JSX. Update the relevant
Header.tsx elements referenced by aria-label and id, including the navigation
menu toggle and mobile panel, and reuse the extracted constants anywhere those
strings appear so the naming stays consistent and is easier to localize later.
🪄 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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: f5faaf7f-59f4-457a-b939-ceb929e982fd

📥 Commits

Reviewing files that changed from the base of the PR and between 0a75ec4 and ad673b9.

📒 Files selected for processing (1)
  • src/components/Header.tsx

Comment thread src/components/Header.tsx
Comment thread src/components/Header.tsx
@codeant-ai

codeant-ai Bot commented Jul 6, 2026

Copy link
Copy Markdown

CodeAnt AI is running Incremental review

@codeant-ai

codeant-ai Bot commented Jul 6, 2026

Copy link
Copy Markdown

Thanks for using CodeAnt! 🎉

We're free for open-source projects. if you're enjoying it, help us grow by sharing.

Share on X ·
Reddit ·
LinkedIn

@github-actions github-actions Bot added size/m and removed need-star labels Jul 6, 2026
@github-actions github-actions Bot removed the size/l label Jul 6, 2026
@codeant-ai codeant-ai Bot added the size:L This PR changes 100-499 lines, ignoring generated files label Jul 6, 2026
@tanvi1107

tanvi1107 commented Jul 6, 2026

Copy link
Copy Markdown
Author

can u merge the changes

@github-actions github-actions Bot added size/l and removed size:L This PR changes 100-499 lines, ignoring generated files size/m labels Jul 6, 2026
@codeant-ai

codeant-ai Bot commented Jul 6, 2026

Copy link
Copy Markdown

CodeAnt AI Incremental review completed.

@tanvi1107

Copy link
Copy Markdown
Author

@knoxiboy can u please merge it

@github-actions github-actions Bot added the merge-conflict PR has merge conflicts that need resolution label Jul 8, 2026
@knoxiboy

knoxiboy commented Jul 8, 2026

Copy link
Copy Markdown
Owner

Hi! Thanks for working on this. We recently cleaned up our styling configurations and relocated some layouts, which has introduced merge conflicts in your changed files.

Could you rebase this branch against main, resolve the conflicts, and update the PR? Thank you!

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

Labels

gssoc'26 GSSoC program issue level:beginner Beginner level task merge-conflict PR has merge conflicts that need resolution quality : needs-work size/l type:bug Bug fix type:docs Documentation update

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Improve Navbar UI/UX and Responsiveness

2 participants