Docs: add hideable navigation sidebar - #28
Merged
Conversation
There was a problem hiding this comment.
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(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Validation
git diff --checknode --check doc/source/_static/sidebar.jsindex.html