Skip to content

feat: Expandable full-title table of contents for browse pages#93

Merged
williamzujkowski merged 1 commit intomainfrom
feat/92-title-toc
Mar 30, 2026
Merged

feat: Expandable full-title table of contents for browse pages#93
williamzujkowski merged 1 commit intomainfrom
feat/92-title-toc

Conversation

@williamzujkowski
Copy link
Copy Markdown
Collaborator

Summary

Transforms the title browse page from a simple chapter list into an expandable table of contents showing every section:

Before: Click Title → see chapter list → click Chapter → see section list → click Section
After: Click Title → see all chapters with expandable section lists → click Section directly

Features

  • <details> elements for zero-JS progressive enhancement
  • Expand/Collapse all buttons for large titles (5+ chapters)
  • Small titles (≤10 chapters) auto-expand
  • Section links go directly to statute detail page
  • Chapter headings still link to chapter page (preserved for deep links)
  • Status badges using frontmatter field (feat: Add 'status' frontmatter field to transformer output #90) with fallback
  • Active/inactive counts per chapter
  • Clean section title display (strips "Section N - " prefix)

Design decisions

  • Chapter pages kept (not removed) — they serve as deep-link targets and are used by the section page sidebar
  • <details> over JS accordion — works without JavaScript, accessible, fast
  • Compact spacing (py-1.5) for scannable lists

Consensus: Approved 3-0

Issues

Test plan

  • svelte-check — 0 errors
  • pnpm test — all pass
  • Visual: verify Title 1 (small, 3 chapters) auto-expands
  • Visual: verify Title 18 (large, 126 chapters) shows expand/collapse all
  • Visual: verify status badges on inactive sections
  • Verify chapter heading links still work

🤖 Generated with Claude Code

Replace simple chapter list with an expandable table of contents showing
every section within each chapter:

- HTML <details> elements for zero-JS progressive enhancement
- Expand/collapse individual chapters by clicking
- Expand all / Collapse all buttons for titles with 5+ chapters
- Small titles (≤10 chapters) auto-expand all chapters
- Section links go directly to /statute/{slug}/ detail page
- Chapter headings link to /browse/title-{n}/chapter-{n}/ (preserved)
- Status badges (Repealed, Reserved, Omitted, Transferred, Renumbered)
  using frontmatter status field with title-based fallback
- Inactive sections dimmed (opacity-50) + italic
- Active/inactive section counts per chapter
- Section titles stripped of "Section N - " prefix for cleaner display
- Compact vertical spacing (py-1.5) for scannable lists

Consensus approved 3-0 (simple_majority).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@williamzujkowski williamzujkowski merged commit f83b679 into main Mar 30, 2026
1 check failed
@williamzujkowski williamzujkowski deleted the feat/92-title-toc branch March 30, 2026 01:10
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