Skip to content

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

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

Fix article-header sidebar toggles when navbar content is present#991
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
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

1 participant