Skip to content

Conversation

krishagandhi0711
Copy link
Contributor

Which issue does this PR close?

Rationale for this change

The Navbar user icons in Admin, Employee, and User interfaces stayed highlighted/selected when users navigated using the browser back button. This caused a visual inconsistency and potential confusion about which menu item or icon was active. The change ensures that dropdowns and focus states are cleared when the route changes, providing a smoother and more intuitive user experience.

What changes are included in this PR?

  • Added a useEffect in all three Navbar components (Admin, Employee, User) to detect route changes via useLocation.
  • Automatically removes focus/highlight from dropdown triggers or user icons whenever the location changes.
  • Maintains all existing functionality (links, dropdown menus, login/logout buttons, tooltips).
  • Minor refactoring to improve readability and consistency across the three Navbars.

Are these changes tested?

  • Manual testing was performed:
    • Navigating between routes and using browser back button no longer keeps dropdown/user icon highlighted.
    • Dropdowns still function normally.
    • Login/logout buttons and navigation links behave as expected.
  • No automated tests added as this is a UI/focus behavior fix, but can be manually verified easily.
SaralSeva.-.Google.Chrome.2025-09-29.17-36-21.mp4

Are there any user-facing changes?

  • Users will no longer see the user icon stay highlighted after using the browser back button.
  • Dropdown menus now correctly reflect current interaction states.
  • No other visual or functional changes.

Copy link

vercel bot commented Sep 29, 2025

@krishagandhi0711 is attempting to deploy a commit to the eccentriccoder01's projects Team on Vercel.

A member of the Team first needs to authorize it.

@eccentriccoder01 eccentriccoder01 added bug Something isn't working gssoc25 level 2 labels Oct 2, 2025
@eccentriccoder01 eccentriccoder01 merged commit 5458cb7 into eccentriccoder01:main Oct 2, 2025
1 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working gssoc25 level 2
Projects
None yet
Development

Successfully merging this pull request may close these issues.

User Icon Stays Selected After Using Browser Back Button
2 participants