Skip to content

fix: improve navbar hover contrast readability#282

Merged
mehul-m-prajapati merged 2 commits into
GitMetricsLab:mainfrom
pari-dubey1:fix-navbar-hover-contrast
May 17, 2026
Merged

fix: improve navbar hover contrast readability#282
mehul-m-prajapati merged 2 commits into
GitMetricsLab:mainfrom
pari-dubey1:fix-navbar-hover-contrast

Conversation

@pari-dubey1
Copy link
Copy Markdown
Contributor

@pari-dubey1 pari-dubey1 commented May 16, 2026

Related Issue


Description

Fixed the navbar hover contrast issue where navigation links became difficult to read on hover due to low text visibility.

Updated hover text colors to improve readability and maintain proper contrast in both light and dark themes.

Changes made:

  • Replaced low-contrast hover text colors
  • Improved accessibility and UI consistency
  • Ensured better user experience across themes

How Has This Been Tested?

  • Tested navbar hover interactions in light mode
  • Tested navbar hover interactions in dark mode
  • Verified readability on desktop view
  • Verified readability on mobile navbar

Screenshots

Before:

Screenshot 2026-05-16 192450

After:

Screenshot 2026-05-16 194231

Screenshot 2026-05-16 194258

Type of Change

  • Bug fix
  • New feature
  • Code style update
  • Breaking change
  • Documentation update

Summary by CodeRabbit

  • Style
    • Updated Navbar link hover styling for improved visual consistency across desktop and mobile views with new bordered/rounded hover effects and refined text colors.

Review Change Stack

@netlify
Copy link
Copy Markdown

netlify Bot commented May 16, 2026

Deploy Preview for github-spy ready!

Name Link
🔨 Latest commit cb52657
🔍 Latest deploy log https://app.netlify.com/projects/github-spy/deploys/6a0989933197b900087ca25f
😎 Deploy Preview https://deploy-preview-282--github-spy.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 16, 2026

📝 Walkthrough

Walkthrough

This PR updates the Navbar component's hover styling to improve navigation link readability. Logo, desktop navigation, and mobile navigation links are restyled with consistent bordered, rounded corners, and theme-aware hover text colors to address contrast issues during interaction.

Changes

Navigation Link Hover Styling

Layer / File(s) Summary
Logo link hover styling
src/components/Navbar.tsx
Logo link's className is updated with aligned light/dark hover text colors and styling consistent with the broader navbar pattern.
Navigation links hover styling
src/components/Navbar.tsx
Desktop navigation links (Home, Tracker, Contributors, Login) and mobile navigation links (Home, About, Contact, Contributors, Login) receive consistent bordered/rounded hover styles with separate light/dark text colors. Mobile links maintain their onClick handlers to close the menu.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

  • GitMetricsLab/github_tracker#167: Both PRs modify src/components/Navbar.tsx's mobile navigation UI—main PR adjusts the mobile link className hover/border styling, while the retrieved PR updates the mobile menu's styling and the mobile "Home" link behavior/routing.

Suggested labels

gssoc25, level1

Poem

🐰 A navbar with style, so shiny and bright,
Links hover with borders, now easy to sight,
Dark mode, light mode, both get their due,
Contrast restored—readability's true!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title directly and clearly addresses the main change: improving navbar hover contrast readability, which matches the file changes and PR objectives.
Description check ✅ Passed The description follows the template with all required sections completed: Related Issue, Description, Testing, Screenshots, and Type of Change. Content is detailed and well-structured.
Linked Issues check ✅ Passed Code changes address issue #233 requirements: improved hover text colors for better contrast in both light and dark themes, maintaining readability and accessibility across desktop and mobile viewports.
Out of Scope Changes check ✅ Passed All changes in Navbar.tsx are focused on fixing the hover contrast issue described in #233. No unrelated modifications or out-of-scope changes were introduced.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


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.

Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

🎉 Thank you @pari-dubey1 for your contribution. Please make sure your PR follows https://github.com/GitMetricsLab/github_tracker/blob/main/CONTRIBUTING.md#-pull-request-guidelines

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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
src/components/Navbar.tsx (2)

127-135: 🛠️ Refactor suggestion | 🟠 Major | ⚡ Quick win

Mobile theme toggle button has the same hover contrast issue.

Like the desktop theme toggle button, the mobile version also uses hover:text-gray-300 without a dark mode variant. This creates the same light mode contrast issue and should be updated to match the navigation links pattern.

🎨 Proposed fix to match navigation link hover pattern
             <button
               onClick={() => {
                 toggleTheme();
                 setIsOpen(false);
               }}
-              className="text-sm font-semibold px-3 py-1 rounded border border-gray-500 hover:text-gray-300 hover:border-gray-300 transition duration-200 w-full text-left"
+              className="text-sm font-semibold px-3 py-1 rounded border border-gray-500 hover:text-gray-700 dark:hover:text-gray-300 hover:border-gray-400 transition duration-200 w-full text-left"
             >
🤖 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/Navbar.tsx` around lines 127 - 135, The mobile theme toggle
button uses a plain hover class (hover:text-gray-300) that lacks a dark-mode
variant, causing poor contrast; update the button's hover classes to match the
navigation links pattern by adding the appropriate dark-mode hover class (e.g.,
dark:hover:text-...) so the element rendered by the onClick handler (toggleTheme
+ setIsOpen) and its label ({mode}) uses the same hover behavior in dark mode as
the desktop nav links.

55-60: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Theme toggle buttons fail WCAG AA contrast in light mode.

The desktop and mobile theme toggle buttons (lines 57 and 132) use hover:text-gray-300 hover:border-gray-300, which produces only 1.47:1 contrast on a white background—failing WCAG AA standards (requires 4.5:1 minimum for normal text).

The navigation links already use the correct pattern: hover:text-gray-700 dark:hover:text-gray-300 hover:border-gray-400, which achieves 10.31:1 contrast in light mode. Apply the same styling to both theme toggle buttons for consistency and accessibility compliance.

Suggested fix
           <button
             onClick={toggleTheme}
-            className="text-sm font-semibold px-3 py-1 rounded border border-gray-500 hover:text-gray-300 hover:border-gray-300 transition duration-200"
+            className="text-sm font-semibold px-3 py-1 rounded border border-gray-500 hover:text-gray-700 dark:hover:text-gray-300 hover:border-gray-400 transition duration-200"
           >
🤖 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/Navbar.tsx` around lines 55 - 60, The theme toggle buttons
(the button using toggleTheme and rendering Sun/Moon based on mode) use
low-contrast classes; update their className to match the nav link pattern by
replacing hover:text-gray-300 hover:border-gray-300 with hover:text-gray-700
dark:hover:text-gray-300 hover:border-gray-400 so both the desktop and mobile
toggle buttons use the accessible hover styles and pass WCAG AA.
🧹 Nitpick comments (2)
src/components/Navbar.tsx (2)

23-23: ⚡ Quick win

Consider adding consistent hover border styling to the logo link.

The logo link has the same hover text colors as the navigation links but lacks the border and rounded corner styling (px-2 py-1 border border-transparent hover:border-gray-400 rounded) that was added to other nav links. This creates inconsistent hover feedback across navigation elements.

For visual consistency, consider applying the same bordered hover effect to the logo link.

✨ Suggested styling update for consistency
-          className="text-2xl font-bold hover:text-gray-700 dark:hover:text-gray-300 cursor-pointer flex items-center"
+          className="text-2xl font-bold hover:text-gray-700 dark:hover:text-gray-300 cursor-pointer flex items-center px-2 py-1 border border-transparent hover:border-gray-400 rounded"
🤖 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/Navbar.tsx` at line 23, The logo link in the Navbar component
currently uses the className "text-2xl font-bold hover:text-gray-700
dark:hover:text-gray-300 cursor-pointer flex items-center" and lacks the
bordered hover styling applied to other nav links; update the logo link's
className in src/components/Navbar.tsx (the element that renders the logo) to
include "px-2 py-1 border border-transparent hover:border-gray-400 rounded" in
addition to the existing classes so its hover feedback matches the other
navigation links.

33-54: ⚡ Quick win

Consider extracting repeated className to a constant.

The same className string is repeated across all desktop navigation links (lines 33, 39, 45, 51):

"text-lg font-medium hover:text-gray-700 dark:hover:text-gray-300 transition-all px-2 py-1 border border-transparent hover:border-gray-400 rounded"

Extracting this to a constant would improve maintainability and ensure consistency across future updates.

♻️ Refactor suggestion to reduce duplication
 const Navbar: React.FC = () => {
 
   const [isOpen, setIsOpen] = useState<boolean>(false);
   const themeContext = useContext(ThemeContext);
+  
+  const navLinkClasses = "text-lg font-medium hover:text-gray-700 dark:hover:text-gray-300 transition-all px-2 py-1 border border-transparent hover:border-gray-400 rounded";
 
   if (!themeContext)

Then use it in the links:

           <Link
             to="/"
-            className="text-lg font-medium hover:text-gray-700 dark:hover:text-gray-300 transition-all px-2 py-1 border border-transparent hover:border-gray-400 rounded"
+            className={navLinkClasses}
           >

Apply the same pattern to the other desktop nav links and mobile nav links (with block ${navLinkClasses} for mobile).

🤖 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/Navbar.tsx` around lines 33 - 54, The repeated className
string used in the Navbar component's Link elements should be extracted to a
single constant (e.g., const navLinkClasses) and then referenced in each desktop
Link (currently the Home, Tracker, Contributors, Login Link elements) to
eliminate duplication; update mobile link usages to use `block
${navLinkClasses}` or equivalent to preserve layout and ensure consistency
across both desktop and mobile navigation.
🤖 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.

Outside diff comments:
In `@src/components/Navbar.tsx`:
- Around line 127-135: The mobile theme toggle button uses a plain hover class
(hover:text-gray-300) that lacks a dark-mode variant, causing poor contrast;
update the button's hover classes to match the navigation links pattern by
adding the appropriate dark-mode hover class (e.g., dark:hover:text-...) so the
element rendered by the onClick handler (toggleTheme + setIsOpen) and its label
({mode}) uses the same hover behavior in dark mode as the desktop nav links.
- Around line 55-60: The theme toggle buttons (the button using toggleTheme and
rendering Sun/Moon based on mode) use low-contrast classes; update their
className to match the nav link pattern by replacing hover:text-gray-300
hover:border-gray-300 with hover:text-gray-700 dark:hover:text-gray-300
hover:border-gray-400 so both the desktop and mobile toggle buttons use the
accessible hover styles and pass WCAG AA.

---

Nitpick comments:
In `@src/components/Navbar.tsx`:
- Line 23: The logo link in the Navbar component currently uses the className
"text-2xl font-bold hover:text-gray-700 dark:hover:text-gray-300 cursor-pointer
flex items-center" and lacks the bordered hover styling applied to other nav
links; update the logo link's className in src/components/Navbar.tsx (the
element that renders the logo) to include "px-2 py-1 border border-transparent
hover:border-gray-400 rounded" in addition to the existing classes so its hover
feedback matches the other navigation links.
- Around line 33-54: The repeated className string used in the Navbar
component's Link elements should be extracted to a single constant (e.g., const
navLinkClasses) and then referenced in each desktop Link (currently the Home,
Tracker, Contributors, Login Link elements) to eliminate duplication; update
mobile link usages to use `block ${navLinkClasses}` or equivalent to preserve
layout and ensure consistency across both desktop and mobile navigation.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 8e9bcd38-cf90-4185-959e-9285dec72c66

📥 Commits

Reviewing files that changed from the base of the PR and between 7a15543 and 5265d1d.

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

@mehul-m-prajapati mehul-m-prajapati merged commit f88465c into GitMetricsLab:main May 17, 2026
6 checks passed
@github-actions
Copy link
Copy Markdown

🎉🎉 Thank you for your contribution! Your PR #282 has been merged! 🎉🎉

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🐛 Bug Report: Navigation Links Become Hard to Read on Hover

2 participants