Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refining Navigation Bar Interaction for Improved Clarity and Engagement #10495

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ananyakaligal
Copy link
Contributor

@ananyakaligal ananyakaligal commented Feb 23, 2025

Closes #10464

Improves the navigation bar's interaction by replacing redundant underlines with a subtle background highlight for hover and bold text for selection. This enhances clarity and makes navigation more intuitive.

Technical

  • The hover effect no longer applies to the selected option, ensuring a clearer distinction between hover and selection states.
  • Styling follows a minimalistic approach with soft transitions and subtle highlights, and extra-boldness for selection.

Testing

Run docker compose run --rm home npm run build-assets to recompile the static assets. Then, open the search page, trending page or any other page which uses nav-bar component to verify the new changes.

Screenshot

Screencast.from.2025-02-23.20-04-57.webm

Screenshot from 2025-02-23 20-07-36

Stakeholders

@cdrini

@ananyakaligal
Copy link
Contributor Author

working on it

@ananyakaligal ananyakaligal force-pushed the newNav branch 2 times, most recently from 35c82ca to 49fd7ae Compare February 23, 2025 15:18
@ananyakaligal ananyakaligal marked this pull request as draft February 23, 2025 15:19
@ananyakaligal ananyakaligal force-pushed the newNav branch 2 times, most recently from 1dc7041 to 49fd7ae Compare February 24, 2025 05:34
@github-actions github-actions bot added the Needs: Response Issues which require feedback from lead label Feb 24, 2025
@cdrini
Copy link
Collaborator

cdrini commented Feb 24, 2025

Nice work @ananyakaligal ! That might be a little too dark; a style like this should work nicely:

tmp.mp4

Here's some rough CSS; will need some organizing. Also note the shade of blue is the same as the shade of blue used for the text/bottom border. We'll just need to brighten it/make it semi-transparent. We can use the less colour functions for this 👍

ul.nav-bar {
  border-bottom: 1px solid #ccc;
  margin-left: -20px !important;
  margin-right: -20px !important;
  padding-top: 5px;
  padding-left: 20px;
  padding-right: 20px;
}

.nav-bar li a {
  display: inline-block;
  position: relative;
  padding-bottom: 6px;
}


.nav-bar li:not(.selected) a {
  font-weight: normal;
}

.nav-bar li:not(.selected):hover a {
  color: #02598b;
  border-bottom: none;
}

.nav-bar li a:after {
  content: "";
  left: 4px;
  right: 4px;
  top: 0;
  bottom: 2px;
  background: #2296d9;
  position: absolute;
  z-index: -1;
  border-radius: 4px;
  opacity: 0.18;
  animation: smallscale 0.2s;
  pointer-event: none;
  display: none;
}

.nav-bar li:not(.selected):hover a:after {
  display: block;
}

.nav-bar li.selected a:after {
  display: block;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: 0;
}

@keyframes smallscale {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    transform: scale(1);
  }
}

@ananyakaligal
Copy link
Contributor Author

@cdrini This looks good. However, I feel that highlighting the selection wouldn’t differentiate it much from the hovering. Instead, having just an underline for the selection while highlighting the hovering makes it more readable. What do you think?

@cdrini
Copy link
Collaborator

cdrini commented Feb 25, 2025

I think having the selected item highlighted is useful, since just the border is a bit subtle. But I think we could make the hover effect more transparent (above they are the exact same transparency); that'll help differentiate it nicely!

Also note there are a few more things differentiating in the above snippet: the border radius/size of the hover rectangle, and I also changed the selected tab to be the only tab that is bold. That should add more pieces of visual contrast!

@ananyakaligal
Copy link
Contributor Author

ananyakaligal commented Feb 25, 2025 via email

@ananyakaligal
Copy link
Contributor Author

@cdrini I made the changes you suggested and added a few small tweaks. I added tiny borders on the top, left, and right to give the selected state a subtle boxed effect without making it too noticeable. I also made sure that the hover effect doesn’t override the selected style when hovering over it. Let me know if any changes are required

Screencast.from.2025-02-28.14-28-47.webm

@ananyakaligal ananyakaligal reopened this Feb 28, 2025
@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 17.27%. Comparing base (606faaf) to head (b5cdba1).
Report is 463 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #10495      +/-   ##
==========================================
- Coverage   17.31%   17.27%   -0.04%     
==========================================
  Files          87       87              
  Lines        4835     4845      +10     
  Branches      856      860       +4     
==========================================
  Hits          837      837              
- Misses       3471     3477       +6     
- Partials      527      531       +4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@cdrini
Copy link
Collaborator

cdrini commented Mar 10, 2025

Awesome thank you @ananyakaligal ! The style there is a bit too different from the style of the rest of the site; let's see if we can use the style I outlined in the CSS snippet above.

@cdrini cdrini added Needs: Submitter Input Waiting on input from the creator of the issue/pr [managed] and removed Needs: Response Issues which require feedback from lead labels Mar 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs: Submitter Input Waiting on input from the creator of the issue/pr [managed]
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Refining Navigation Bar Interaction for Improved Clarity and Engagement
3 participants