feat: add active navigation highlight#463
Conversation
|
Someone is attempting to deploy a commit to the firefistisdead's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughLandingNavbar now tracks which landing-page section is in view using an IntersectionObserver, stores the most-visible section in ChangesLanding Navbar Active Section Highlighting
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
frontend/src/components/Landing/LandingNavbar.jsx (1)
57-60: ⚡ Quick winAdd semantic active-state for screen readers.
Set
aria-current="page"on the active nav link so assistive tech gets the same active context as visual users.Small accessibility improvement
-<a href="`#features`" className={`navbar-link ${activeSection === 'features' ? 'active' : ''}`}>Features</a> +<a + href="`#features`" + className={`navbar-link ${activeSection === 'features' ? 'active' : ''}`} + aria-current={activeSection === 'features' ? 'page' : undefined} +> + Features +</a>🤖 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 `@frontend/src/components/Landing/LandingNavbar.jsx` around lines 57 - 60, In LandingNavbar.jsx update the anchor elements that use activeSection (the four <a> links with className `navbar-link`) to include aria-current="page" only when that link is active (e.g., when activeSection === 'features' for the Features link); ensure the attribute is present on the active link and absent on non-active links so screen readers receive the same active-state as visual users.
🤖 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.
Inline comments:
In `@frontend/src/components/Landing/LandingNavbar.jsx`:
- Around line 25-40: The current useEffect in LandingNavbar.jsx creates one
IntersectionObserver per section which can yield nondeterministic active-section
updates; instead create a single IntersectionObserver that observes all elements
in the sections array inside useEffect and in its callback deterministically
pick the winning entry (e.g., choose the entry with highest intersectionRatio,
breaking ties by largest IntersectionObserverEntry.time or explicit geometry
rule) and call setActiveSection with that entry.target.id; ensure you observe
each element with that single observer and retain the existing cleanup by
disconnecting the single observer on unmount.
In `@frontend/src/components/Landing/Navbar.css`:
- Around line 170-173: Remove the border-bottom from .navbar-link.active and
instead toggle the existing pseudo-element underline (.navbar-link::after) for
the active state; update .navbar-link.active to set the ::after variant (for
example by changing its opacity/transform/height or adding an active class
selector like .navbar-link.active::after) so the same underline pseudo-element
is used with the same transitions, and ensure .navbar-link.active no longer
applies border-bottom to avoid layout jitter.
---
Nitpick comments:
In `@frontend/src/components/Landing/LandingNavbar.jsx`:
- Around line 57-60: In LandingNavbar.jsx update the anchor elements that use
activeSection (the four <a> links with className `navbar-link`) to include
aria-current="page" only when that link is active (e.g., when activeSection ===
'features' for the Features link); ensure the attribute is present on the active
link and absent on non-active links so screen readers receive the same
active-state as visual users.
🪄 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: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 5243de97-ec39-4b15-b16a-933340756c23
📒 Files selected for processing (2)
frontend/src/components/Landing/LandingNavbar.jsxfrontend/src/components/Landing/Navbar.css
Fix #338
Summary
Added active state highlighting to the navigation bar to visually indicate the current page/section the user is on.
Changes
LandingNavbar.jsxto track and apply active state to nav linksNavbar.csswith styles for the active navigation highlightScreenshots
Summary by CodeRabbit
New Features
Style