From ea62d071376b63617d9ce04c2f7209301ab6efc9 Mon Sep 17 00:00:00 2001 From: Angus Hollands Date: Wed, 12 Jun 2024 11:56:24 +0100 Subject: [PATCH 1/5] fix: breaking style changes in pydata-sphinx-theme --- pyproject.toml | 2 ++ .../assets/styles/sections/_header-article.scss | 4 ++-- .../assets/styles/sections/_header-primary.scss | 2 +- .../assets/styles/sections/_sidebar-primary.scss | 4 +++- .../components/toggle-primary-sidebar.html | 4 ++-- .../components/toggle-secondary-sidebar.html | 4 ++-- tests/test_build/build__header-article.html | 6 +++--- 7 files changed, 15 insertions(+), 11 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 2ade6497..8b740c95 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -81,11 +81,13 @@ doc = [ test = [ "beautifulsoup4", "coverage", + "defusedxml", "myst-nb", "pytest", "pytest-cov", "pytest-regressions", "sphinx_thebe", + "pydata-sphinx-theme>=0.15.2" ] [project.entry-points] diff --git a/src/sphinx_book_theme/assets/styles/sections/_header-article.scss b/src/sphinx_book_theme/assets/styles/sections/_header-article.scss index a741c647..626b47db 100644 --- a/src/sphinx_book_theme/assets/styles/sections/_header-article.scss +++ b/src/sphinx_book_theme/assets/styles/sections/_header-article.scss @@ -15,7 +15,7 @@ * Sidebar toggle over-rides for PST */ // Primary toggle is always visible -label.sidebar-toggle.primary-toggle { +button.sidebar-toggle.primary-toggle { @media (min-width: $breakpoint-md) { display: inline-block; } @@ -25,7 +25,7 @@ label.sidebar-toggle.primary-toggle { } // Secondary toggle mimics behavior of "persistent header" div of PST -label.sidebar-toggle.secondary-toggle { +button.sidebar-toggle.secondary-toggle { @media (min-width: $breakpoint-lg) { display: none; } diff --git a/src/sphinx_book_theme/assets/styles/sections/_header-primary.scss b/src/sphinx_book_theme/assets/styles/sections/_header-primary.scss index d8b11583..c52f46e7 100644 --- a/src/sphinx_book_theme/assets/styles/sections/_header-primary.scss +++ b/src/sphinx_book_theme/assets/styles/sections/_header-primary.scss @@ -4,7 +4,7 @@ // Turn these off because we'll show it in the article header // The primary sidebar toggle - label.sidebar-toggle { + button.sidebar-toggle { display: none; } } diff --git a/src/sphinx_book_theme/assets/styles/sections/_sidebar-primary.scss b/src/sphinx_book_theme/assets/styles/sections/_sidebar-primary.scss index 1cb70716..05532f89 100644 --- a/src/sphinx_book_theme/assets/styles/sections/_sidebar-primary.scss +++ b/src/sphinx_book_theme/assets/styles/sections/_sidebar-primary.scss @@ -36,7 +36,9 @@ // It is shown by default, and hidden with a click. // Mobile behavior is defined in the pydata sphinx theme @media (min-width: $breakpoint-lg) { - input#__primary:checked ~ .bd-container .bd-sidebar-primary { + input#pst-primary-sidebar-checkbox:checked + ~ .bd-container + .bd-sidebar-primary { margin-left: -$sidebar-primary-width-widescreen; visibility: hidden; opacity: 0; diff --git a/src/sphinx_book_theme/theme/sphinx_book_theme/components/toggle-primary-sidebar.html b/src/sphinx_book_theme/theme/sphinx_book_theme/components/toggle-primary-sidebar.html index c8139e85..6b25347a 100644 --- a/src/sphinx_book_theme/theme/sphinx_book_theme/components/toggle-primary-sidebar.html +++ b/src/sphinx_book_theme/theme/sphinx_book_theme/components/toggle-primary-sidebar.html @@ -1,3 +1,3 @@ -