Skip to content

fix(sidebar): match L2+ group headers to nested leaf font size#1989

Merged
markdumay merged 1 commit into
mainfrom
fix/sidebar-nested-group-font-size
Jul 9, 2026
Merged

fix(sidebar): match L2+ group headers to nested leaf font size#1989
markdumay merged 1 commit into
mainfrom
fix/sidebar-nested-group-font-size

Conversation

@markdumay

Copy link
Copy Markdown
Collaborator

Problem

The sidebar mixes font sizes by intent: L1 entries render at the base size (16px) and L2+ entries at the small size (14px). But nested (L2+) group headers render at 16px instead of 14px, so a collapsible parent looks larger than the leaves around it at the same visual level.

Root cause

Leaves and group headers are rendered by two different inline partials, and only one applies the small class:

  • Leaves (inline/sidebar/item.html) add small to the anchor for level != 0, so nested leaves are 14px. ✓
  • Group headers (inline/sidebar/group.html) render the title anchor with no class at all, so every collapsible parent inherits the 16px base regardless of depth. ✗

Fix

Add small to the group anchor when the group is nested:

- <a {{ with $dest }} href="{{ . }}"{{ else }}
+ <a {{ if gt $level 1 }}class="small" {{ end }}{{ with $dest }} href="{{ . }}"{{ else }}

Groups sit one level deeper than leaves in the recursion (a top-level group is level 1, a top-level leaf is level 0), so the threshold is gt $level 1 here versus ne $level 0 for items. Top-level (L1) group headers are unchanged.

Verification

Built exampleSite against the change. The shipped example content never nests groups two deep, so a temporary 3-level fixture was added to exercise the L2+ group path, then removed:

Entry Level small? Size
Group parent L1 (top of nav) no 16px ✓ (unchanged)
Group parent L2, nested yes 14px ✓ (fixed)
Leaf L2+ yes 14px ✓ (unchanged)

A full scan of every rendered page confirmed 240 L1 group headers, none wrongly shrunk — no regression. The change is CSS-class only (Bootstrap .small) and does not affect the group link's color/layout rules or the collapse chevron.

🤖 Generated with Claude Code

Nested (L2+) group headers rendered at the L1 base size (16px) instead
of the small size (14px) used by every other L2+ entry. Leaf items apply
the `small` class for level != 0, but the group-title anchor in group.html
carried no class, so collapsible parents stayed at the base size at any
depth.

Add `small` to the group anchor when the group is nested. Groups sit one
level deeper than leaves (a top-level group is level 1, a top-level leaf
is level 0), so the threshold is `gt $level 1` here versus `ne $level 0`
for items. Top-level (L1) group headers are unchanged.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@netlify

netlify Bot commented Jul 9, 2026

Copy link
Copy Markdown

Deploy Preview for gethinode-demo ready!

Name Link
🔨 Latest commit e6faf9c
🔍 Latest deploy log https://app.netlify.com/projects/gethinode-demo/deploys/6a4f37e4bb9ae6000870288b
😎 Deploy Preview https://deploy-preview-1989--gethinode-demo.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@markdumay markdumay enabled auto-merge July 9, 2026 05:58
@markdumay markdumay merged commit d166650 into main Jul 9, 2026
15 checks passed
@markdumay markdumay deleted the fix/sidebar-nested-group-font-size branch July 9, 2026 06:01
@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 2.18.2 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant