Skip to content

Improve navbar hover and active state visibility#4379

Open
Awanthiy wants to merge 3 commits intoOWASP:mainfrom
Awanthiy:improve-navbar-hover-state
Open

Improve navbar hover and active state visibility#4379
Awanthiy wants to merge 3 commits intoOWASP:mainfrom
Awanthiy:improve-navbar-hover-state

Conversation

@Awanthiy
Copy link
Copy Markdown

@Awanthiy Awanthiy commented Mar 26, 2026

Proposed change

Resolves #4364

Improved navbar hover and active states to enhance visibility and usability in both light and dark modes.

Changes made

  • Updated hover color for better visibility in light mode
  • Improved active state clarity for better navigation feedback
  • Maintained consistency across light and dark themes

Notes

The light mode color can be further refined based on feedback.

Checklist

  • I followed the contributing workflow
  • I verified that my code works as intended and resolves the issue as described
  • I ran make check-test locally
  • I used AI for code, documentation, tests, or communication related to this PR

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 26, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: ac1224f4-fde3-4099-bebd-ea8f6781f98a

📥 Commits

Reviewing files that changed from the base of the PR and between faaa926 and 7529454.

📒 Files selected for processing (1)
  • frontend/src/components/Header.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • frontend/src/components/Header.tsx

Summary by CodeRabbit

  • Style

    • Refined header navigation link styling with improved color transitions, hover effects, and smoother animations
    • Updated active navigation link appearance with refined typography and new accent colors
  • Accessibility

    • Made page-state indication accessible by only marking a link as the current page when it matches the active path

Walkthrough

Replaced className composition for non-dropdown desktop navigation links in Header.tsx to new Tailwind classes (hover, active, transition) and made aria-current="page" conditional only when pathname === link.href.

Changes

Cohort / File(s) Summary
Header — nav link styling
frontend/src/components/Header.tsx
Rewrote desktop non-dropdown link classes to px-3 py-2 text-sm font-medium ... transition-colors duration-200 with light-mode lime hover and dark-mode blue hover; active-state now uses text-lime-700 dark:text-blue-400 and font-semibold. aria-current set only when pathname === link.href.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

Suggested reviewers

  • arkid15r
  • kasya
🚥 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 clearly summarizes the main change: improving navbar hover and active state visibility, which aligns with the changeset that updates navbar styling.
Description check ✅ Passed The description is related to the changeset, referencing issue #4364 and describing the navbar improvements made, though it could include more technical detail.
Linked Issues check ✅ Passed The code changes fully address issue #4364 objectives: improved hover color for light mode visibility [#4364], enhanced active state styling with new color scheme [#4364], and consistent light/dark theme behavior [#4364]. All linked requirements are met.
Out of Scope Changes check ✅ Passed All changes are in-scope: the Header.tsx modifications directly address navbar hover/active state visibility improvements specified in #4364, with no extraneous changes detected.

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

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

cubic-dev-ai[bot]
cubic-dev-ai bot previously approved these changes Mar 26, 2026
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

No issues found across 3 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Since this is your first cubic review, here's how it works:

  • cubic automatically reviews your code and comments on bugs and improvements
  • Teach cubic by replying to its comments. cubic learns from your replies and gets better over time
  • Add one-off context when rerunning by tagging @cubic-dev-ai with guidance or docs links (including llms.txt)
  • Ask questions if you need clarification on any suggestion

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

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

97-117: Desktop and mobile navigation styling are now inconsistent.

The PR objective states "consistent hover and active behavior across both light and dark themes." The desktop links now use lime/blue active states (text-lime-700 dark:text-blue-400), but the mobile menu at lines 221-231 still uses the old blue-based styling (font-bold text-blue-800 dark:text-white). Consider updating the mobile menu to match for visual consistency.

♻️ Suggested mobile menu update (lines 224-226)
                     className={cn(
-                      'navlink block px-3 py-2 text-slate-700 transition duration-150 ease-in-out hover:bg-slate-100 hover:text-slate-900 dark:text-slate-300 dark:hover:bg-slate-700 dark:hover:text-white',
-                      pathname === link.href && 'font-bold text-blue-800 dark:text-white'
+                      'navlink block px-3 py-2 text-slate-700 transition duration-150 ease-in-out hover:bg-slate-100 hover:text-lime-600 dark:text-slate-300 dark:hover:bg-slate-700 dark:hover:text-blue-400',
+                      pathname === link.href && 'font-semibold text-lime-700 dark:text-blue-400'
                     )}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@frontend/src/components/Header.tsx` around lines 97 - 117, Update the mobile
menu link classes to match the desktop link hover/active behavior: replace the
old classes (e.g., "font-bold text-blue-800 dark:text-white") used in the mobile
menu Link rendering with the same class pattern used in the Header desktop Link
(the cn(...) call that yields "text-lime-700 dark:text-blue-400" and
"font-semibold" for active state and the hover variants). Locate the mobile
menu's JSX that maps over links (the mobile Link elements in the Header
component) and apply the same cn(...) class logic or equivalent class names so
hover and active styling are consistent across light/dark themes.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@frontend/src/components/Header.tsx`:
- Line 114: Header.tsx currently sets aria-current="page" unconditionally on nav
links; change it to only include aria-current="page" when the link is the active
route. Fix by computing an isActive boolean (e.g., using react-router's
useLocation or NavLink's isActive callback) and render aria-current={isActive ?
"page" : undefined} (or omit the attribute when false) on the link element in
Header (the element that currently contains aria-current="page"). This ensures
only the current page link has aria-current set.

---

Nitpick comments:
In `@frontend/src/components/Header.tsx`:
- Around line 97-117: Update the mobile menu link classes to match the desktop
link hover/active behavior: replace the old classes (e.g., "font-bold
text-blue-800 dark:text-white") used in the mobile menu Link rendering with the
same class pattern used in the Header desktop Link (the cn(...) call that yields
"text-lime-700 dark:text-blue-400" and "font-semibold" for active state and the
hover variants). Locate the mobile menu's JSX that maps over links (the mobile
Link elements in the Header component) and apply the same cn(...) class logic or
equivalent class names so hover and active styling are consistent across
light/dark themes.
🪄 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: efea18bb-6d51-4d56-80e2-ad817ebe9b0f

📥 Commits

Reviewing files that changed from the base of the PR and between 2789f46 and faaa926.

⛔ Files ignored due to path filters (2)
  • frontend/package-lock.json is excluded by !**/package-lock.json
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (1)
  • frontend/src/components/Header.tsx

cubic-dev-ai[bot]
cubic-dev-ai bot previously approved these changes Mar 26, 2026
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

0 issues found across 1 file (changes from recent commits).

coderabbitai[bot]
coderabbitai bot previously approved these changes Mar 26, 2026
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.

Hi @Awanthiy, thanks for working on this.
Did you add any pkg?
I don't think we need it just for improving the hover effect for the navbar...
It's 25k+ lines here

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Thanks for pointing that out. I accidentally included the lockfile changes generated locally by npm. I’ve now removed them so the PR only contains the intended navbar updates.

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.

Its recommended to run make check-test locally before pushing your code.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for pointing that out @hassaansaleem28 ! Moreover, it's actually required 👍🏼

@sonarqubecloud
Copy link
Copy Markdown

Copy link
Copy Markdown
Collaborator

@kasya kasya left a comment

Choose a reason for hiding this comment

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

@Awanthiy thank you for working on this.

I'm not sure I like the lime color for hover color to be honest 🤔 Do you have any other options that would work with out current color scheme in mind?
If so, could you first attach screenshots to this PR so that we can compare a couple of options? Ideally that would be added to the issue, but since we are already on the PR stage - let's do it here.

Also, please run make check-test - this is required for all PRs. Currently both linter checks and tests are failing.

href={link.href || '/'}
className={cn(
`
px-3 py-2 text-sm font-medium
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Not sure why you wanted to make the text smaller... but can we keep it as it was before? 14px is too small in my opinion.

Suggested change
px-3 py-2 text-sm font-medium
px-3 py-2 font-medium

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve navbar hover and active state visibility

3 participants