Skip to content

fix: sidebar last items hidden behind header on scroll#8852

Open
system-conf wants to merge 1 commit intonodejs:mainfrom
system-conf:fix/sidebar-last-item-hidden
Open

fix: sidebar last items hidden behind header on scroll#8852
system-conf wants to merge 1 commit intonodejs:mainfrom
system-conf:fix/sidebar-last-item-hidden

Conversation

@system-conf
Copy link
Copy Markdown

Summary

Fixes #8521

The sidebar navigation clips the last items when scrolled down. The root cause is that the sidebar container uses h-svh (100% of small viewport height) with top-0, but the NavBar sits at the top consuming ~4rem of vertical space. This means the last sidebar items are pushed below the visible viewport area.

Changes

packages/ui-components/src/Containers/Article/index.module.css:

  • Changed ml:top-0ml:top-[var(--header-height)] — positions sidebar below the header
  • Changed ml:h-svhml:h-[calc(100svh-var(--header-height))] — sizes sidebar to remaining viewport

packages/ui-components/src/Containers/Sidebar/index.module.css:

  • Removed ml:pb-[var(--header-height)] — no longer needed since the container now correctly accounts for header height

How to test

  1. Navigate to any learn/docs page with a long sidebar (e.g., /en/learn/getting-started/introduction-to-nodejs)
  2. Scroll the sidebar to the bottom
  3. Verify that all sidebar items are visible and the last items are not clipped
  4. Test with and without a banner visible (e.g., security release banner)
  5. Test on different screen sizes (mobile, tablet, desktop)

Co-Authored-By: Claude Opus 4.7 noreply@anthropic.com

Fixes nodejs#8521

The sidebar container was using `h-svh` (100svh) with `top-0`,
making it exactly viewport height but starting from the top where
the header overlaps. This caused the last sidebar items to be
clipped when scrolled down.

Changes:
- Set sidebar top to `var(--header-height)` to position it below
  the header
- Set sidebar height to `calc(100svh - var(--header-height))` to
  account for the header's vertical space
- Removed unnecessary `pb-[var(--header-height)]` padding from
  sidebar wrapper since the container now correctly sizes itself

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@system-conf system-conf requested a review from a team as a code owner April 27, 2026 13:45
@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 27, 2026

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

Project Deployment Actions Updated (UTC)
nodejs-org Ready Ready Preview Apr 27, 2026 1:46pm

Request Review

@cursor
Copy link
Copy Markdown

cursor Bot commented Apr 27, 2026

PR Summary

Low Risk
CSS-only layout tweaks to sticky sidebar sizing/positioning; low risk but could slightly affect scroll behavior and spacing across responsive breakpoints.

Overview
Fixes sidebar scroll clipping by offsetting the sticky sidebar container below the header and reducing its height to the remaining viewport (using var(--header-height) in Article/index.module.css).

Removes the sidebar wrapper’s extra bottom padding (Sidebar/index.module.css) since the sidebar now accounts for header height directly.

Reviewed by Cursor Bugbot for commit 473584e. Bugbot is set up for automated code reviews on this repo. Configure here.

@github-actions
Copy link
Copy Markdown
Contributor

👋 Codeowner Review Request

The following codeowners have been identified for the changed files:

Team reviewers: @nodejs/nodejs-website

Please review the changes when you have a chance. Thank you! 🙏

Copy link
Copy Markdown
Member

@avivkeller avivkeller left a comment

Choose a reason for hiding this comment

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

The code makes sense to me, but I'm not sure if we accept contributions entirely written by Artificial Intelligence, cc @nodejs/web-admins

@MattIPv4
Copy link
Copy Markdown
Member

https://ai-coding-assistants-policy.openjsf.org/ does not restrict how much of a submission is written by AI, just that it must be correctly attributed to AI and not violate license restrictions, and that the human submitter is taking responsibility (the human opened the PR here, not the AI, so that seems like a valid sign).

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 27, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 73.22%. Comparing base (60aeb4b) to head (473584e).
⚠️ Report is 2 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8852      +/-   ##
==========================================
- Coverage   73.23%   73.22%   -0.02%     
==========================================
  Files         102      102              
  Lines        8623     8623              
  Branches      313      313              
==========================================
- Hits         6315     6314       -1     
- Misses       2307     2308       +1     
  Partials        1        1              

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

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.

Cannot see last item in sidebar after scrolling down, need to scroll down the whole page

3 participants