Skip to content

docs: fix sidebar nav collapse behaviour and group the per-builder guides - #697

Merged
amrit-agarwal-1 merged 4 commits into
mainfrom
docs/nav-collapsible
Sep 9, 2026
Merged

docs: fix sidebar nav collapse behaviour and group the per-builder guides#697
amrit-agarwal-1 merged 4 commits into
mainfrom
docs/nav-collapsible

Conversation

@amrit-agarwal-1

@amrit-agarwal-1 amrit-agarwal-1 commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Two changes to the docs sidebar.

1. Preserve collapse state across navigation

Collapsible sections re-expanded on every page load, so any section a reader collapsed sprang back open as soon as they navigated. navigation.expand renders every section with Material's md-toggle--indeterminate class, which the theme treats as expanded; the server re-emits it on each page load, discarding the reader's choice.

Removing the flag, plus a small script that remembers expand/collapse choices in sessionStorage, with the current page's ancestors pinned open so you can't hide where you are. State is fingerprinted so a nav-tree change drops stale entries, and all storage access is wrapped in try/catch.

2. Group the per-builder guides

The AI App Builders section lists one page per builder, so it grows every time we add one. navigation.sections prevents collapsing a top-level section, and removing it is a site-wide change we don't want — but it only applies at the top level, so one level down groups collapse normally (Coded Apps → CI/CD already does).

- AI App Builders:
    - Getting Started: ai-app-builders/getting-started.md
    - Guides:
        - Vercel (v0): ai-app-builders/vercel.md
        - Replit: ai-app-builders/replit.md
        - Bolt: ai-app-builders/bolt.md
        - Lovable: ai-app-builders/lovable.md

The section stays three rows however many builders we add, and the entry points stay visible.

Verification

Built and loaded in a browser: Guides renders as a collapsible node, not force-expanded, and the persistence script ships. The second change depends on the first — with navigation.expand still on, the new node would render permanently open.

Docs-site only — no SDK source, no public API surface.

🤖 Generated with Claude Code

@amrit-agarwal-1
amrit-agarwal-1 requested a review from a team August 31, 2026 06:30
@claude

claude Bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

✅ No issues found. Checked for bugs and CLAUDE.md compliance.

@github-actions

github-actions Bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor
PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-09-09 08:07 UTC

Comment thread mkdocs.yml
- navigation.footer
- navigation.indexes
- navigation.sections
- navigation.top

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The PR description says navigation.prune was also added ("so the full tree isn't rendered into every page"), but it isn't in the file. Without it, MkDocs renders the complete nav tree into every page's HTML — a non-trivial payload with 72 entries. Suggest adding it here:

Suggested change
- navigation.top
- navigation.prune
- navigation.top

@claude

claude Bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

One finding this run: the PR description states navigation.prune was added (to prevent rendering the full nav tree in every page), but it is absent from mkdocs.yml. Flagged inline with a code suggestion.

Comment thread mkdocs.yml
@claude

claude Bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

One new finding this run:

mkdocs.yml line 51navigation.sections is still present in both features blocks, but the PR description states it was dropped alongside navigation.expand. With navigation.sections enabled, Material renders top-level entries as fixed section headers with no toggle, so the JavaScript collapse-state persistence in extra.js cannot make them collapsible — navToggles() only captures nested input[id^="__nav"]\] elements that navigation.sections` prevents from existing at the top level. Flagged inline with a suggestion.

@amrit-agarwal-1 amrit-agarwal-1 changed the title docs: make the sidebar sections collapsible docs(ai-app-builders): group the per-builder guides under one collapsible node Aug 31, 2026
@claude

claude Bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

✅ No issues found. Checked for bugs and CLAUDE.md compliance.

@amrit-agarwal-1 amrit-agarwal-1 changed the title docs(ai-app-builders): group the per-builder guides under one collapsible node docs: fix sidebar nav collapse behaviour and group the per-builder guides Aug 31, 2026
@claude

claude Bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

✅ No issues found. Checked for bugs and CLAUDE.md compliance.

Comment thread docs/overrides/assets/javascripts/extra.js Outdated
@claude

claude Bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

One new finding this run:

docs/overrides/assets/javascripts/extra.js lines 243–245 and 264–266 — two bare catch {} blocks in readNavState and updateNavState swallow errors silently. CLAUDE.md requires console.warn(error) on any catch that doesn't re-throw, and explicitly names "best-effort reads from an ambient channel" (i.e. sessionStorage) as the canonical example. Flagged inline with code suggestions for both.

@amrit-agarwal-1
amrit-agarwal-1 force-pushed the docs/nav-collapsible branch 2 times, most recently from e12139f to bd052b3 Compare August 31, 2026 08:43
@claude

claude Bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

✅ No issues found. Checked for bugs and CLAUDE.md compliance.

@claude

claude Bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

✅ No issues found. Checked for bugs and CLAUDE.md compliance.

Comment thread docs/overrides/assets/javascripts/extra.js
@claude

claude Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

✅ No issues found. Checked for bugs and CLAUDE.md compliance.

@claude

claude Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

✅ No issues found. Checked for bugs and CLAUDE.md compliance.

The docs sidebar re-expanded every collapsible section on each page load,
so any section the reader collapsed sprang back open when they navigated.

Two causes, two fixes:

- `navigation.expand` was enabled in mkdocs.yml (listed twice, in a
  duplicated features block). It renders every section with Material's
  `md-toggle--indeterminate` class, which the theme's CSS treats exactly
  like `:checked`. Removed, so only the current page's ancestors open.

- Material has no built-in persistence of manual expand/collapse, so
  extra.js now records explicitly-opened sections in sessionStorage and
  reapplies them per load, with a CSS rule suppressing the animation
  while state is restored.

Also ignore the remaining generated API docs. `docs/api/` was already
ignored while its sibling outputs from the same `npm run docs:api`
command were not, so they showed up as untracked noise.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
amrit-agarwal-1 and others added 3 commits September 8, 2026 23:57
…ible node

The section lists a page per builder, so it grows with every builder we
add. navigation.sections blocks collapsing a top-level section, but one
level down groups collapse normally, so the per-builder pages move under
a Guides node. The section stays three rows however many builders we add.

Nav only — no theme flags, so nothing changes elsewhere on the site.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Renames the nav section from AI App Builders to App Builder Integrations.

The walkthroughs page moves to ai-app-builders/guides/index.md so it
becomes the Guides section index, the same shape the API Reference uses
for agents/. Clicking Guides opens it, and the four per-builder pages sit
under it — no separate nav row for the page itself.

Its URL changes from /ai-app-builders/videos/ to /ai-app-builders/guides/.
The per-builder pages keep their URLs. Cross-links updated on the four
guide pages, Getting Started, the Codex plugin page, and the Coded Apps
CLI reference.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Both catches around sessionStorage returned silently. agent_docs/
conventions.md requires a console.warn on any catch that does not
re-throw, naming best-effort reads from an ambient channel as the case.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@claude

claude Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

✅ No issues found. Checked for bugs and CLAUDE.md compliance.

@sonarqubecloud

sonarqubecloud Bot commented Sep 9, 2026

Copy link
Copy Markdown

@amrit-agarwal-1
amrit-agarwal-1 merged commit 18938f9 into main Sep 9, 2026
42 of 58 checks passed
@amrit-agarwal-1
amrit-agarwal-1 deleted the docs/nav-collapsible branch September 9, 2026 08:07
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.

4 participants