Problem Description
Hello Sphinx Book Theme Community,
I believe some people have recently noticed the following two severe bugs in the new version of the sphinx-book-theme:
- An extra
search-button-field appears by default in the navbar between the announcement banner and the doc page.
- The expand/collapse functionality of the toggle primary/secondary buttons in desktop or mobile layout stops working.
Actually, these two bugs have already been reported by others:
- The 1st bug was reported in #986.
- The 2nd bug was reported in #917, #935, and #988.
And some people have even tried submitting PRs to fix them:
- PR #987 to fix issue #986 (the 1st bug).
- PR #991 to fix issue #935 (the 2nd bug).
After thoroughly examining the source code, I have confirmed the root causes of these two bugs. Simply put:
- The 1st bug is caused by changes in the new version of the upstream
pydata-sphinx-theme.
- The 2nd bug is due to an oversight in the original design of the downstream
sphinx-book-theme.
Furthermore, there is a clear causal relationship between these two bugs:
Changes in the new version of the PyData theme caused the default value of navbar_persistent in the Book theme to become ["search-button-field"]. This exposed the fact that when designing the expand/collapse functionality for the primary/secondary toggle buttons, the Book theme apparently failed to consider whether it would function properly "when there are elements present in the navbar".
When do these two bugs show up?
After testing with the following commands, we can confirm that the two bugs mentioned above only start appearing from version v1.3.0:
Click to expand the testing commands
# Build the v1.4.0 documentation
VERSION=v1.4.0
git clone --branch=$VERSION [https://github.com/executablebooks/sphinx-book-theme.git](https://github.com/executablebooks/sphinx-book-theme.git) sbt-$VERSION
cd sbt-$VERSION
uv run --python 3.12 --link-mode=copy --extra doc sphinx-build -b html docs docs/_build/html
firefox docs/_build/html/index.html
cd ..
# Build the v1.3.0 documentation
VERSION=v1.3.0
git clone --branch=$VERSION [https://github.com/executablebooks/sphinx-book-theme.git](https://github.com/executablebooks/sphinx-book-theme.git) sbt-$VERSION
cd sbt-$VERSION
uv run --python 3.12 --link-mode=copy --extra doc sphinx-build -b html docs docs/_build/html
firefox docs/_build/html/index.html
cd ..
# Build the v1.2.0 documentation
VERSION=v1.2.0
git clone --branch=$VERSION [https://github.com/executablebooks/sphinx-book-theme.git](https://github.com/executablebooks/sphinx-book-theme.git) sbt-$VERSION
cd sbt-$VERSION
uv run --python 3.12 --link-mode=copy --extra doc sphinx-build -b html docs docs/_build/html
firefox docs/_build/html/index.html
cd ..
# Build the v1.1.4 documentation
VERSION=v1.1.4
git clone --branch=$VERSION [https://github.com/executablebooks/sphinx-book-theme.git](https://github.com/executablebooks/sphinx-book-theme.git) sbt-$VERSION
cd sbt-$VERSION
uv run --python 3.12 --link-mode=copy --extra doc --reinstall sphinx-build -b html docs docs/_build/html
firefox docs/_build/html/index.html
This is primarily caused by commit 8e676945 in the PyData theme (which first appeared in the 0.17.1 release). Furthermore, Book theme 1.3.0 officially began depending on PyData 0.17.1:
| Book Theme |
PyData Theme |
Status |
1.4.0 |
0.20.0 |
FAILED |
1.3.0 |
0.17.1 |
FAILED |
1.2.0 |
0.16.1 |
PASSED |
1.1.4 |
0.15.4 |
PASSED |
Problem Description
Hello Sphinx Book Theme Community,
I believe some people have recently noticed the following two severe bugs in the new version of the
sphinx-book-theme:search-button-fieldappears by default in the navbar between the announcement banner and the doc page.Actually, these two bugs have already been reported by others:
And some people have even tried submitting PRs to fix them:
After thoroughly examining the source code, I have confirmed the root causes of these two bugs. Simply put:
pydata-sphinx-theme.sphinx-book-theme.Furthermore, there is a clear causal relationship between these two bugs:
Changes in the new version of the PyData theme caused the default value of
navbar_persistentin the Book theme to become["search-button-field"]. This exposed the fact that when designing the expand/collapse functionality for the primary/secondary toggle buttons, the Book theme apparently failed to consider whether it would function properly "when there are elements present in the navbar".When do these two bugs show up?
After testing with the following commands, we can confirm that the two bugs mentioned above only start appearing from version
v1.3.0:Click to expand the testing commands
This is primarily caused by commit
8e676945in the PyData theme (which first appeared in the0.17.1release). Furthermore, Book theme1.3.0officially began depending on PyData0.17.1:1.4.00.20.01.3.00.17.11.2.00.16.11.1.40.15.4