Skip to content

Docs: add hideable navigation sidebar - #28

Merged
borisbat merged 1 commit into
masterfrom
codex/hideable-docs-sidebar
Jul 24, 2026
Merged

Docs: add hideable navigation sidebar#28
borisbat merged 1 commit into
masterfrom
codex/hideable-docs-sidebar

Conversation

@borisbat

Copy link
Copy Markdown
Owner

Summary

  • add an accessible hide/show control for the Sphinx RTD navigation sidebar
  • default to a reading-first collapsed layout at 769-1099px while keeping wide desktop navigation visible
  • remember the explicit desktop/tablet preference and preserve the theme's existing mobile hamburger behavior

Validation

  • git diff --check
  • node --check doc/source/_static/sidebar.js
  • local Sphinx render verified the toggle markup, script reference, and copied asset in index.html
  • full generated-reference Sphinx build and repository checks run in CI

Copilot AI review requested due to automatic review settings July 24, 2026 19:57

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Adds a desktop/tablet hide/show control for the Sphinx RTD theme navigation sidebar, enabling a “reading-first” collapsed layout on narrower desktop widths while preserving existing mobile hamburger behavior and persisting user preference across pages.

Changes:

  • Include a new docs JS asset via Sphinx config (html_js_files).
  • Inject a sidebar toggle button into the RTD layout template.
  • Implement sidebar collapse/expand behavior (localStorage preference + responsive sync) and add accompanying CSS transitions/positioning.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
doc/source/conf.py Registers sidebar.js so it’s emitted into built docs pages.
doc/source/_templates/layout.html Adds the desktop/tablet toggle button markup to the RTD layout.
doc/source/_static/sidebar.js Implements responsive collapse logic + preference persistence + ARIA/icon/label sync.
doc/source/_static/custom.css Styles the toggle and collapsed layout behavior for ≥769px (with reduced-motion handling).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +8 to +12
<button type="button"
class="forge-sidebar-toggle"
aria-controls="forge-site-navigation"
aria-expanded="true">
<i class="fa fa-chevron-left" aria-hidden="true"></i>
Comment on lines +48 to +49
navigation.id = 'forge-site-navigation';

Comment on lines +90 to +92
desktopMedia.addEventListener('change', syncLayout);
narrowDesktopMedia.addEventListener('change', syncLayout);
syncLayout();
@borisbat
borisbat merged commit d24c2b7 into master Jul 24, 2026
6 checks passed
@borisbat
borisbat deleted the codex/hideable-docs-sidebar branch July 24, 2026 20:11
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