feat(sidebar): flatten the top-level nav heading - #66
Merged
Conversation
A single top-level heading (the common one-registry site) rendered as a collapsible <details> wrapping every subgroup, indenting the whole nav one level too deep and adding a redundant "DOCUMENTATION" fold. Now subgroups are the menu's top level: a lone heading is dropped entirely, and several headings render as static `.menu-title` labels (mt-4 spacing, no fold) — only subgroups collapse. Same rule for the Landing doc index, which printed its "Documentation" h2 directly above a same-text per-group h3 on single-heading sites. No config, JS, or CSS-contract change: nav_groups keeps its shape, docs-nav keys persistence by summary text (the removed details just orphans one stale localStorage key), and menu-title was already @source inline'd. Refs #65
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Closes #65
Summary
The sidebar rendered its top-level heading as a collapsible
<details>wrapping every subgroup, so a one-registry site (every current consuming site) got a redundant chevroned "DOCUMENTATION" level and one extra indent on the whole nav.Now subgroups are the top level of the menu:
menu-titlelabel withmt-4 first:mt-0breathing room — no fold; only subgroups collapse.h3is skipped when there is exactly one heading, fixing the stacked "DOCUMENTATION / DOCUMENTATION" duplicate under the hero.Intentionally unconditional (settled in the plan interview): no config knob — all consuming sites get the flattened chrome on upgrade.
What did NOT change
nav_groupskeeps its{ "Heading" => { "Subgroup" => [NavItem] } }shape — explicitc.navlambdas work verbatim.<details>just orphans one harmless localStorage key.menu-titlewas already@source inline'd in the generated stylesheet, and the new utilities are literals in gem Ruby scanned by thebin/build-cssglobs.Test Coverage
spec/docs_ui/sidebar_spec.rb— single heading dropped; subgroups render as top-level<details open>; multiple headings render asmenu-title<li>s (never<summary>s) with the spacing classes; empty headings excluded from the count; every<details>staysopen(JS-off regression guard).spec/docs_ui/landing_spec.rb(new) — single heading: "Documentation" appears once, noh3; multiple headings: bothh3labels render.Verification
bundle exec rspec— 806 examples, 0 failures (94.0% line coverage)bundle exec rubocop— no offenses@sourceneededDeviations & judgment calls
c.navlambda can contain empty headings (e.g.{ "Docs" => {…}, "Empty" => {} }), which the registry-derived path never produces. Empty headings are excluded from the count, so one real + one empty heading still gets the single-heading rule (heading dropped). Covered by a spec.h3is skipped, the columnulalso drops itsmt-3top margin — otherwise the links float an extra 12px below theh2for no reason. Both class lists stay fully literal for the Tailwind scanner.menu-titleand all utilities were already covered by the generated CSS contract, so no generator/template change was needed.