From c3305a6541e0af556b6cf47351961651931aeb31 Mon Sep 17 00:00:00 2001 From: Haowei Hsu Date: Sun, 20 Sep 2026 04:56:32 +0800 Subject: [PATCH] fix: remove duplicate sidebar toggles from navbar header Override `sections/header.html` to drop the primary/secondary toggle buttons that pydata-sphinx-theme 0.20.0 renders in the top navbar. Those navbar toggles are a second set of `.primary-toggle` / `.secondary-toggle` in the DOM, and the theme JS binds the first match via `querySelector()`. On wide screens the navbar toggles are hidden by CSS, so the visible article-header toggles stopped working. With the navbar toggles removed, only the article-header toggles remain, restoring `sphinx-book-theme<=1.2.0` behavior. --- .../sphinx_book_theme/sections/header.html | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 src/sphinx_book_theme/theme/sphinx_book_theme/sections/header.html diff --git a/src/sphinx_book_theme/theme/sphinx_book_theme/sections/header.html b/src/sphinx_book_theme/theme/sphinx_book_theme/sections/header.html new file mode 100644 index 000000000..a442db9b1 --- /dev/null +++ b/src/sphinx_book_theme/theme/sphinx_book_theme/sections/header.html @@ -0,0 +1,39 @@ +{% if theme_navbar_start or theme_navbar_center or theme_navbar_end or theme_navbar_persistent %} +
+ {% set navbar_start, navbar_class, navbar_align = navbar_align_class() %} + {% if theme_navbar_start %} + + {% endif %} + + {# A search button to show up only on mobile #} + {% for navbar_item in theme_navbar_persistent %} + + {% endfor %} +
+{% endif %}