Skip to content

docs: stop clipping the GitHub star count in the nav overflow menu - #1429

Merged
jdx merged 1 commit into
mainfrom
fix/nav-star-badge-clip
Sep 14, 2026
Merged

jdx merged 1 commit into
mainfrom
fix/nav-star-badge-clip

Conversation

@jdx

@jdx jdx commented Sep 14, 2026

Copy link
Copy Markdown
Owner

Problem

Between 768px and 1279px wide, VitePress collapses the nav bar's social links
into the "…" overflow menu. The GitHub star count that sits under the GitHub
icon was cut off by the menu's bottom edge on usage.jdx.dev — only the top few pixels of
★ 1k were visible above the dropdown's rounded corner.

Cause

The count is drawn inside the GitHub link's bottom padding, and a negative
margin-bottom pulls that 12px strip back out of flow so the badge doesn't
stretch the nav bar. VitePress's .VPMenu sets overflow-y: auto, which clips
anything hanging past its padding box, so in the overflow menu the badge lost
4px of its 9.6px line.

Fix

Inside .VPNavBarExtra only, drop the negative margin so the padding stays in
flow and the menu grows by 12px to fit the count. The nav bar at ≥1280px,
where the social links render inline, is untouched.

Validation

Ran the docs dev server and drove headless Chromium against it at 780px, 1000px
and 1270px wide, opening the "…" menu and measuring the badge against the menu's
clip box:

  • before: the badge's bottom edge sat 4px past the clip box
  • after: 8px of clearance, ★ 1k fully visible
  • at 1400px the nav bar is still 64px tall and the inline badge is unchanged

AI-assisted — Tool: Claude Code; model: anthropic/claude-opus-5; version: 2.1.270.


Note

Low Risk
Docs-only CSS scoped to the nav overflow menu; no runtime or security impact.

Overview
Fixes the GitHub star badge (★ 1k) being cut off when social links move into the VitePress “…” overflow menu (roughly 768px–1279px).

The badge sits in the link’s bottom padding while a negative margin-bottom keeps the main nav bar height unchanged at wide breakpoints. That out-of-flow strip gets clipped by the overflow menu’s overflow-y: auto. The PR adds a scoped override under .VPNavBarExtra that sets margin-bottom: 0 so the padding stays in flow and the menu grows to show the full count, plus a short comment explaining the tradeoff. Inline nav at ≥1280px is unchanged.

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

Summary by CodeRabbit

  • Style
    • Adjusted the GitHub star-count link’s spacing in the navigation overflow menu to prevent visual clipping and improve alignment.

Between 768px and 1279px VitePress moves the social links into the nav
bar's "..." overflow menu. The star count is drawn in the GitHub link's
bottom padding and pulled out of flow with a negative bottom margin so it
does not stretch the nav bar, but `.VPMenu` sets `overflow-y: auto`, so
the menu clipped the count at its padding box and only the top few pixels
were visible.

Keep that bottom padding in flow inside the overflow menu so the menu
grows to fit the count instead. The nav bar at >=1280px is unchanged.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Sep 14, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Central YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Advanced

Run ID: a73f45ce-feb5-4b4a-903d-da5f3f12bd3b

📥 Commits

Reviewing files that changed from the base of the PR and between b10f3de and 191a6d5.

📒 Files selected for processing (1)
  • docs/.vitepress/theme/custom.css

Included review availability: Your plan provides up to 4 included reviews per hour; 3 remain after this review.


📝 Walkthrough

Walkthrough

The VitePress theme now resets the GitHub star-count link’s bottom margin inside the overflow menu. This prevents the scrollable menu from clipping content that extends beyond its padding box.

Changes

Overflow Menu Spacing

Layer / File(s) Summary
Overflow menu CSS adjustment
docs/.vitepress/theme/custom.css
Adds a targeted rule that sets margin-bottom: 0 !important for the GitHub star-count link inside .VPNavBarExtra.

Priority: ⬇️ Low

Estimated code review effort: 1 (Trivial) | ~3 minutes

Change: Bug fix

Merge Risk: ⚪ Minimal · up to 191a6

The overflow-menu spacing adjustment is narrowly scoped and does not introduce a known production or documentation risk.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: preventing the GitHub star count from clipping in the navigation overflow menu.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@greptile-apps

greptile-apps Bot commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

The PR appears safe to merge, with no actionable correctness, security, or maintainability issues identified.

Summary

  • Restores the GitHub link’s bottom margin only within .VPNavBarExtra.
  • Leaves the inline desktop navigation behavior unchanged.

Reviews (1) · Last reviewed commit: "docs: stop clipping the GitHub star coun..."

@jdx
jdx enabled auto-merge (squash) September 14, 2026 19:25
@jdx
jdx merged commit 8597cfe into main Sep 14, 2026
12 checks passed
@jdx
jdx deleted the fix/nav-star-badge-clip branch September 14, 2026 19:35
@github-actions

Copy link
Copy Markdown
Contributor

Instruction counts

The comparison never ran — an earlier step failed.

191a6d5558ae vs `` · measured on the runner, not pushed to the history.

jdx added a commit to jdx/mise that referenced this pull request Sep 14, 2026
## Problem

Between 768px and 1279px wide, VitePress collapses the nav bar's social
links
into the "…" overflow menu. On mise.jdx.dev the GitHub star count
disappeared
entirely at those widths — the menu showed a bare GitHub icon.

## Cause

VitePress renders the GitHub link twice: inline in the nav bar, and
again inside
the overflow menu. The badge injector used `querySelector`, so it always
matched
the inline link — which is `display: none` below 1280px — and appended
the badge
there. The menu's copy never got one.

## Fix

Inject into every match, and disconnect the `MutationObserver` once each
link has
its badge instead of re-running on every DOM mutation the page makes for
the rest
of its life. This matches what hk, pitchfork, usage and mr-boxington
already do.

No CSS change was needed: the badge sits 8px clear of the menu's clip
box, so it
does not hit the clipping that
[jdx/pitchfork#862](jdx/pitchfork#862),
[jdx/usage#1429](jdx/usage#1429) and
[jdx/pacvamp#91](jdx/pacvamp#91) fix.

## Validation

Built the docs (`mise run docs:build`), served the output, and drove
headless
Chromium against it:

- at 1000px the "…" menu now shows `★ 33.9k`, 8px clear of the menu's
clip box
- at 1400px the inline badge's bounding box is identical to production
today
  (x 1299.0, y 41, 45.9×12) and the nav bar is still 64px tall
- the hamburger nav screen below 768px is unaffected — it had no badge
before
  this change either, on mise or any of the sibling sites

*AI-assisted — Tool: Claude Code; model: anthropic/claude-opus-5;
version: 2.1.270.*

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Low Risk**
> Docs-site nav DOM injection only; no changes to app logic, auth, or
data handling.
> 
> **Overview**
> Fixes missing GitHub star badges when VitePress moves social links
into the nav **"…"** overflow menu (roughly 768px–1279px).
> 
> The theme injector in `docs/.vitepress/theme/index.ts` now uses
**`querySelectorAll`** so **every** mise GitHub nav link gets a
`.star-count` badge (inline + overflow copy), skips work when
`starsData` is empty, and treats “all links badged” as success. The
**`MutationObserver`** is scoped to **`.VPNav`**, **disconnects** once
badges are on all links (instead of watching `document.body` on every
mutation), and is torn down in **`onUnmounted`**; the old immediate +
`setTimeout(100)` retry path is removed.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
40cbad9. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **Bug Fixes**
- GitHub star count badges now appear on all matching GitHub links,
including links in the overflow menu.
- Badge updates now reliably handle navigation elements that load or
change dynamically.
- Badge monitoring stops once all applicable links are updated,
improving behavior and preventing unnecessary ongoing activity.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
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