GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(ui): keep active sidebar item visible on navigation by codebyanas · Pull Request #9154 · nodejs/nodejs.org

Conversation

@codebyanas

@codebyanas codebyanas commented Sep 9, 2026

Copy link
Copy Markdown

Description

Fixes #8828.

The sidebar's internal scroll position could leave the active navigation item outside the visible area after navigation. This change ensures that the active sidebar link is automatically scrolled into view when the pathname changes.

The implementation:

  • Finds the active sidebar link after navigation.
  • Checks whether it is inside the sidebar viewport.
  • Adjusts only the sidebar's scrollTop when the item is off-screen.
  • Keeps the existing sidebar scroll-position restoration behavior.
  • Supports locale-prefixed routes such as /en/about/....

Testing

Tested locally by navigating between sidebar pages and verifying that the active item remains visible after navigation.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@codebyanas
fix(ui): keep active sidebar item visible on navigation
afe0b93
@codebyanas
codebyanas requested a review from a team as a code owner September 9, 2026 21:29
Copilot AI lite review requested due to automatic review settings September 9, 2026 21:29
@vercel

vercel Bot commented Sep 9, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
nodejs-org Ready Ready Preview Oct 10, 2026 2:04am UTC

Request Review

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Copilot started reviewing on behalf of codebyanas September 9, 2026 21:30
View session
@vercel
vercel Bot deployed to Preview September 9, 2026 21:31
View deployment
@codebyanas
Merge branch 'main' into fix/sidebar-active-item-scroll
89403f9
@vercel
vercel Bot deployed to Preview September 9, 2026 21:33
View deployment
Copilot AI reviewed Sep 9, 2026
View reviewed changes

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

🟡 Changes recommended

The new effect currently won’t re-run on locale-only route changes (locale switch keeps pathname stable), so the “active item visible” behavior can fail in that navigation path.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR updates the site’s sidebar wrapper to keep the currently active navigation link visible after route changes by automatically adjusting the sidebar container’s internal scrollTop when needed.

Changes:

  • Adds a useEffect that finds the active sidebar link after navigation and scrolls it into view if it’s outside the sidebar viewport.
  • Keeps existing “preserve sidebar scroll position” behavior via useScrollToElement.
  • Uses pathname-based matching to identify the active link (including locale-prefixed URLs).
File summaries
File Description
apps/site/components/withSidebar.tsx Adds an effect that scrolls the active sidebar item into view after pathname changes.
Review details
  • Files reviewed: 1/1 changed files
  • Comments generated: 2
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread apps/site/components/withSidebar.tsx Outdated
0,
offsetTop - aside.clientHeight / 2 + active.offsetHeight / 2
);
}, [pathname]);
Comment thread apps/site/components/withSidebar.tsx Outdated
Comment on lines +57 to +60
const active = [
...(aside?.querySelectorAll<HTMLAnchorElement>('a[href]') ?? []),
].find(link => new URL(link.href).pathname === window.location.pathname);

codebyanas added 2 commits September 10, 2026 02:45
@codebyanas
fix(ui): address review feedback for sidebar active item scroll
2ad0276
@codebyanas
Merge branch 'fix/sidebar-active-item-scroll' of https://github.com/c…
755e0a0
…odebyanas/nodejs.org into fix/sidebar-active-item-scroll
@vercel
vercel Bot deployed to Preview September 9, 2026 21:49
View deployment
@codebyanas
Merge branch 'main' into fix/sidebar-active-item-scroll
9427006
@vercel
vercel Bot deployed to Preview October 10, 2026 02:04
View deployment

This branch was successfully deployed

1 active deployment
Preview — 9427006a Deployed Oct 10, 2026 by vercel[bot]
View deployment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

Copilot code review Copilot
Copilot review effort
Applies to this pull request for everyone.Learn more about Copilot code review.
Copilot left review comments

At least 1 approving review is required to merge this pull request.

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Sidebar scroll position resets on navigation, active item can be off-screen

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@codebyanas
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.