Skip to content

Pin the listing sidebar by its bottom so the sponsors show early - #88

Merged
lbesecker195 merged 1 commit into
mainfrom
fix/sidebar-scrolls-with-page
Oct 1, 2026
Merged

lbesecker195 merged 1 commit into
mainfrom
fix/sidebar-scrolls-with-page

Conversation

@lbesecker195

Copy link
Copy Markdown
Owner

Closes #87.

The problem, measured

On Context7 at 1024×768:

sidebar height 2,175px
visible sidebar (pinned at 128px) ~640px
sponsors start 670px down the sidebar — below the visible part
page height 11,735px

Pinned by its top, the sidebar showed only its first screenful until the main column ran out, so the sponsors stayed out of view until near the end of the page.

The fix

Pin it by its bottom: a colocated hook sets top to window height − sidebar height − 24px (negative when the sidebar is taller than the window). The sidebar then scrolls with the page until its last panel is in view, and holds there. The browser does the scrolling — there is no scroll listener. The hook recalculates on window resize and whenever the sidebar changes height (README loading, tabs, secrets), and JS.ignore_attributes(["style"]) stops LiveView patches from stripping the value.

Tried on the live page before writing it:

scrolled sponsors visible in the sidebar
0 / 400px 0px
800px 243px
1,200–1,600px 640px — the whole visible sidebar
2,100px → end sidebar settled at the bottom

Same speed as the page, not faster. The sponsor block (1,127px) is taller than the visible sidebar, so a sidebar that raced to its bottom would scroll the tiles past before anyone saw them.

Below the lg breakpoint the sidebar stacks under the content and is left alone.

Tests: 232 passing; the new one checks the hook and the attribute guard are wired. The scrolling itself is verified in a browser after deploy.


Pages affected:

🤖 Generated with Claude Code

The sidebar on a listing page is taller than the window -- 2,175px on a
768px screen -- but was pinned by its top, so only its first screenful
was ever visible. The sponsors sit below that and stayed out of view
until the main column ended, 11,735px down on Context7.

- A hook sets a negative sticky top (window height minus sidebar height),
  so the sidebar scrolls with the page until its last panel shows, then
  holds. The browser does the scrolling; there is no scroll listener
- It recalculates when the window or the sidebar changes size, and LiveView
  is told the style is the client's so a patch does not strip it
- Same speed as the page: the sponsor block is taller than the visible
  sidebar, so a faster sidebar would scroll the tiles past unseen
- Below the lg breakpoint the sidebar stacks under the content, unchanged

Closes #87

---

Pages affected:

- [Context7 MCP](https://ai.mcpharbor.dev/servers/io.github.upstash/context7) -- the listing the fix was measured on.
- [browse MCP servers](https://ai.mcpharbor.dev/servers) -- every listing it leads to.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@lbesecker195
lbesecker195 merged commit 527eabd into main Oct 1, 2026
@lbesecker195
lbesecker195 deleted the fix/sidebar-scrolls-with-page branch October 1, 2026 20:21
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.

Listing sidebar hides the sponsors until the end of the page

1 participant