Skip to content

Restore the mobile sidebar toggles in the docs - #1872

Merged
sunt05 merged 1 commit into
masterfrom
sunt05-claude/docs-mobile-sidebars-4a9700
Oct 22, 2026
Merged

sunt05 merged 1 commit into
masterfrom
sunt05-claude/docs-mobile-sidebars-4a9700

Conversation

@sunt05

@sunt05 sunt05 commented Oct 22, 2026

Copy link
Copy Markdown
Contributor

Summary

On phone-width screens neither docs sidebar opened: the site-navigation and "on this page" toggles did nothing.

sphinx-book-theme 1.4.0 pins pydata-sphinx-theme 0.20.0, which adds a search field to the top navbar whenever navbar_persistent is not set. That renders the PyData header, with its own hidden copies of both sidebar toggles, ahead of the book theme's visible ones. The theme JavaScript binds to the first .primary-toggle / .secondary-toggle on the page, so the hidden buttons got the handlers and the visible ones did nothing.

Changes

Verification

Docs built with the gallery off and checked in a headless browser:

  • 375x812: one toggle of each kind per page; both sidebars open on tap; the search button opens its dialog; the colour-mode menu switches light, dark and auto.
  • 1280 wide: the extra top bar that held only a duplicate search field is gone; toggle behaviour matches the book theme's own docs.

The published 2026.6.5 docs pick this up only when the docs anchor is rebuilt.

On phone-width screens neither the site-navigation nor the "on this page"
toggle opened its sidebar. sphinx-book-theme 1.4.0 pins
pydata-sphinx-theme 0.20.0, which adds a search field to the top navbar
whenever `navbar_persistent` is absent from `html_theme_options`. That
renders the PyData header, carrying its own hidden copies of both
sidebar toggles, ahead of the book theme's visible ones. The theme JS
binds to the first `.primary-toggle` / `.secondary-toggle` in the page,
so the hidden buttons got the handlers and the visible ones did nothing.

Set `navbar_persistent=[]`, the same default the book theme's own fix
applies (executablebooks/sphinx-book-theme#987, merged after 1.4.0 and
not yet released). The PyData header now renders empty, each page has
one toggle of each kind, and both sidebars open on mobile. On desktop
the top bar that held only a duplicate search field (executablebooks/sphinx-book-theme#986) is
gone, and the toggles behave as on the book theme's own docs.

Pin sphinx-book-theme to 1.4.0 so the theme pair (and the markup the
toggles depend on) only changes deliberately; the docs CI installs
from `pyproject.toml`, so this is the effective pin.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

CI Build Plan

Changed Files

Documentation (2 files)

  • docs/source/conf.py
  • pyproject.toml

pyproject.toml (1 file)

  • pyproject.toml

Build Configuration

No code build required -- changes are docs/site/non-code only.

Rationale

  • No build-triggering changes detected -> builds skipped

Updated by CI on each push. See path-filters.yml for category definitions.

@sunt05
sunt05 added this pull request to the merge queue Oct 22, 2026
Merged via the queue into master with commit 593ab43 Oct 22, 2026
21 checks passed
sunt05 added a commit that referenced this pull request Oct 22, 2026
Carries the docs/source/conf.py change of #1872 into the 2026.6.5 docs:
html_theme_options navbar_persistent=[] stops pydata-sphinx-theme 0.20
from adding a hidden navbar whose sidebar toggles capture the theme JS,
which left the visible toggles unable to open the sidebars on phones.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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