Skip to content

Add adaptive left-hand TOC for GitHub Pages docs#2

Merged
jclem merged 2 commits intomainfrom
codex/add-collapsible-table-of-contents-to-documentation
Mar 4, 2026
Merged

Add adaptive left-hand TOC for GitHub Pages docs#2
jclem merged 2 commits intomainfrom
codex/add-collapsible-table-of-contents-to-documentation

Conversation

@jclem
Copy link
Copy Markdown
Owner

@jclem jclem commented Mar 4, 2026

Motivation

  • Improve navigation for the docs by adding a persistent left-side table of contents that stays visually minimal until the user interacts with it.
  • Provide an accessible, touch-friendly alternative on small screens so the TOC can be toggled and doesn't rely on hover.

Description

  • Add a slim fixed TOC shell and a ☰ Sections toggle to docs/index.html and wrap content in a .layout container to reserve space for the sidebar.
  • Implement CSS for low-visibility bar placeholders (.toc-bar) that expand and reveal .toc-label on hover/focus and provide responsive styles for mobile (.toc-toggle, .toc.is-expanded).
  • Add runtime JS that enumerates each section's <h2>, auto-assigns stable IDs, builds .toc-link entries, and highlights the active section using IntersectionObserver.
  • Detect touch devices with a media query and switch to a collapsible TOC UX on touch devices so hover is not required.

Testing

  • Ran git diff --check with no reported issues.
  • Served the docs via python3 -m http.server 4173 --directory docs and verified rendering in a headless browser.
  • Captured desktop and mobile screenshots using Playwright (Firefox) to validate the expanded and collapsed states, which completed successfully.
  • Attempted xmllint --html --noout docs/index.html but the xmllint binary was not available in the environment.

Codex Task

Apply the Folio light/dark palette to docs/index.html and tighten the table of contents visual design.

Replace per-item bars with a compact sections chip, add desktop pin/unpin behavior on the § control, and stabilize hover/mobile open-close behavior to remove jitter.

Also add install commands to the Quick start block.
@jclem jclem marked this pull request as ready for review March 4, 2026 16:19
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d51969f6ca

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread docs/index.html
Comment on lines +902 to +905
tocToggle.hidden = true;
tocPin.hidden = prefersTouch;
tocToggle.setAttribute('aria-expanded', 'false');
toc.classList.toggle('is-expanded', prefersTouch || toc.classList.contains('is-pinned'));
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Keep touch desktop TOC collapsible

On non-mobile touch devices (e.g. tablet widths above 520px), this branch hides both TOC controls and forces the sidebar open via is-expanded, so users cannot collapse it. Because the layout only reserves the collapsed gutter (.layout keeps padding-left: 3.75rem), the permanently expanded TOC can overlap the main content area on common tablet viewports, which is a navigation and readability regression specific to coarse-pointer desktop layouts.

Useful? React with 👍 / 👎.

@jclem jclem merged commit d63b8a4 into main Mar 4, 2026
1 check passed
@jclem jclem deleted the codex/add-collapsible-table-of-contents-to-documentation branch March 4, 2026 18:03
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