Skip to content

feat(legal): collapsible On This Page TOC, wider column spacing - #1623

Closed
felixwidjaja wants to merge 1 commit into
mainfrom
feat/legal-toc-collapsible-spacing
Closed

feat(legal): collapsible On This Page TOC, wider column spacing#1623
felixwidjaja wants to merge 1 commit into
mainfrom
feat/legal-toc-collapsible-spacing

Conversation

@felixwidjaja

Copy link
Copy Markdown
Member

Summary

Follow-up to #1621 — makes the /legal/* "On This Page" TOC collapsible for long docs, and fixes the column spacing plus a few regressions found while testing it live.

Changes

  • Collapsible TOC — added an opt-in collapsible prop to TableOfContents.astro. H3 sub-headings are grouped under their parent H2 behind a chevron toggle instead of always being listed out. The group containing the currently active heading auto-expands on scroll (via the existing IntersectionObserver) and the rest collapse; the chevron also lets you manually peek at another group. The handbook's usage is untouched (collapsible defaults to false).
  • Column spacing.legal-content had px-0, which read as squished against both the sidenav and the TOC. Gave it md:px-10 lg:px-16, the same values .handbook-content already uses.
  • Font-size regression fix — the new H2 group wrapper (.toc-group) had dropped the datum-text-sm sizing that .toc-item used to provide via inheritance, so grouped H2 entries were rendering at an unstyled, larger size than the H3 sub-items.
  • Active-dot indicator fixoverflow-y: auto (added previously so a long TOC scrolls internally) forces overflow-x to clip too, per the CSS Overflow spec. That was clipping the active-dot's intentional negative-left bleed onto the dashed guide line, leaving a "broken circle." Added pl-2 as safe clearance.
  • Sub-item spacing fix.toc-sublist had no gap between its <li> items, so a wrapped line within one heading and the gap to the next heading looked identical. Added flex flex-col gap-2, and sized legal's H3 sub-items down to datum-text-xs for clearer hierarchy (handbook's H3 sizing is untouched).

Test plan

  • npx astro check — 0 errors
  • Confirmed handbook's TOC markup is unchanged (still flat .toc-item, no .toc-group) — the new grouping only renders when collapsible is passed
  • Confirmed the MSA's TOC renders 16 groups, only leaf sections (no children) omit the toggle button, and only the first group is open by default
  • Manual visual QA on /legal/master-services-agreement (long doc, multiple multi-child groups) and /handbook/eos/vto (regression check) across breakpoints

🤖 Generated with Claude Code

@felixwidjaja
felixwidjaja requested a review from kaleygel August 11, 2026 15:42
@github-actions

Copy link
Copy Markdown
Contributor

🔎 SEO & Meta Review

Skipped (mode: skipped-no-match).

No built pages matched the changed slugs.

@AriaEdo
AriaEdo force-pushed the feat/legal-toc-collapsible-spacing branch from bf2792c to 3687c10 Compare August 12, 2026 01:35
- Add an opt-in collapsible prop to TableOfContents.astro that groups
  h3 sub-headings under their parent h2 behind a chevron toggle, so
  long docs (e.g. the MSA) don't list every sub-section at once. The
  group containing the active heading auto-expands on scroll and
  collapses the rest; the chevron also allows manually peeking at
  other groups. Handbook's usage is untouched (defaults to false).
- Wire collapsible=true into the legal page's TOC.
- Widen .legal-content's horizontal padding to md:px-10 lg:px-16,
  matching .handbook-content, to fix the squished feel between the
  sidenav/content/TOC columns.
- Fix font-size regression on the h2 group headers: the new .toc-group
  wrapper had dropped the datum-text-sm sizing .toc-item used to
  provide via inheritance.
- Fix the active-dot indicator getting clipped: overflow-y-auto (added
  for the long-TOC scroll fix) forces overflow-x to clip too per the
  CSS Overflow spec, cutting off the dot's intentional negative-left
  bleed onto the dashed guide line. Added pl-2 as safe clearance.
- Fix missing gap between .toc-sublist items — without it, a wrapped
  line within one heading and the gap to the next heading looked
  identical. Also size legal's h3 sub-items down to datum-text-xs for
  clearer hierarchy (handbook's h3 sizing is untouched).
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.

2 participants