Skip to content

Nav: current-page indicator and underline on hover#45

Merged
Kanyandula merged 1 commit intomasterfrom
feature/nav-active-state-and-underline
May 4, 2026
Merged

Nav: current-page indicator and underline on hover#45
Kanyandula merged 1 commit intomasterfrom
feature/nav-active-state-and-underline

Conversation

@Kanyandula
Copy link
Copy Markdown
Owner

Summary

Make the desktop nav (Home / About / Contact) and the mobile menu links feel navigated — they now reflect the page the user is on, and they react on hover instead of just sitting there.

This is the small follow-up the audit flagged but didn't itemise: top-level nav links had a soft color tween on hover and no current-page indicator at all.

Desktop nav

  • Active link: text-primary + permanent underline (underline-offset-4 decoration-2).
  • Inactive link: keeps the existing text-on-surface/70 → hover:text-primary-container color shift and gains hover:underline on top.
  • Active detection via {% with active=request.resolver_match.url_name %} — same pattern the mobile bottom nav already uses.
  • Active link gets aria-current="page" for screen readers.

Mobile menu

  • Active link: text-primary + font-medium. No underline (taps are small).
  • Inactive: text-on-surface/70 (matches the existing Account / Logout / Sign in baseline).
  • The previously hardcoded "Home is bold and dark, About/Contact are light" treatment is gone — Home becomes inactive-styled when the user is on /about or /contact.
  • Same aria-current="page" on the active link.

Tailwind

Rebuilt static/css/tailwind.min.css to pull underline-offset-4, decoration-2, and hover:underline into the bundle (they weren't used before).

Test plan

  • Visit / — Home is highlighted with the underline; About / Contact are not.
  • Visit /about and /contact — only the matching link is highlighted in both light and dark mode.
  • Hover an inactive desktop link — color shifts and underline appears, both transitioning over 300ms.
  • Open the mobile menu on each page — only the matching link is bold + primary-coloured.
  • Screen reader announces the active link as "current page".
  • No layout shift: decoration-2 underline-offset-4 doesn't push neighbouring nav items.

Out of scope

  • The desktop bookmarks shortcut, account dropdown, and theme toggle are not "navigation" in this sense — they don't get an active state.
  • View Transitions / hx-boost for full-page navigation transitions are still PR 2.

Desktop nav (Home / About / Contact) and the mobile menu links now
reflect the page you are on, instead of always rendering identically.

Desktop:
- Active link: text-primary + permanent underline (offset-4, decoration-2).
- Inactive link: existing text-on-surface/70 → hover:text-primary-container
  color shift, plus a hover:underline that animates in via transition-colors.

Mobile menu:
- Active link: text-primary + font-medium (no underline; small targets).
- Inactive: text-on-surface/70 baseline (matches existing other links).
- Home is no longer hardcoded as the active state — drops to inactive when
  the user is on /about or /contact.

Active detection uses request.resolver_match.url_name (matches the pattern
already used by the mobile bottom nav). Active link also gets
aria-current="page" for screen readers.

Tailwind rebuilt to pull underline-offset-4, decoration-2, and
hover:underline into the bundle.
@Kanyandula Kanyandula merged commit 15eee2d into master May 4, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant