Skip to content

Fix article-header sidebar toggles when navbar content is present - #991

Closed
BetterAndBetterII wants to merge 1 commit into
executablebooks:mainfrom
BetterAndBetterII:fix/article-header-sidebar-toggle
Closed

BetterAndBetterII wants to merge 1 commit into
executablebooks:mainfrom
BetterAndBetterII:fix/article-header-sidebar-toggle

Conversation

@BetterAndBetterII

Copy link
Copy Markdown

When a navbar_* slot is set, pydata-sphinx-theme emits a navbar .primary-toggle / .secondary-toggle earlier in the DOM than the article-header control this theme shows. _header-primary.scss hides the navbar buttons, so the visible control is the article-header one.

fixSidebarToggle used document.querySelector, which bound only the first (hidden) button. Clicks on the article-header Toggle Sidebar therefore did nothing on desktop.

Bind every matching toggle. On wide viewports the handler still toggles pst-sidebar-hidden and stops PST from opening a dialog. On narrow viewports it does not intercept, so the dialog path stays with PST.

Also covers the empty-navbar_* case (single article-header button) and the secondary sidebar toggle.

Fixes #935

Bind every .primary-toggle and .secondary-toggle. querySelector only
wired the hidden navbar button pydata-sphinx-theme emits first.

Fixes executablebooks#935
@bsipocz

bsipocz commented Sep 29, 2026

Copy link
Copy Markdown
Member

Based on the discussion and final comment in #999 I expect this issue has been resolved and thus I'm closing this PR.

Please feel free to reopen if you still see the problem using the main branch.

@bsipocz bsipocz closed this Sep 29, 2026
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.

Sidebar toggle buttons missing click handlers on desktop when navbar content is present

2 participants