Skip to content

Commit b33aeac

Browse files
gabalafouivanov
authored andcommitted
Fix sticky header (pydata#1630)
* Fix sticky header * regression test
1 parent 7ff5087 commit b33aeac

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

src/pydata_sphinx_theme/theme/pydata_sphinx_theme/layout.html

+2-4
Original file line numberDiff line numberDiff line change
@@ -67,16 +67,14 @@
6767
<div class="search-button__search-container">{% include "../components/search-field.html" %}</div>
6868
</div>
6969

70-
<header>
7170
{%- if theme_announcement -%}
7271
{% include "sections/announcement.html" %}
7372
{%- endif %}
7473
{% block docs_navbar %}
75-
<div class="bd-header navbar navbar-expand-lg bd-navbar">
74+
<header class="bd-header navbar navbar-expand-lg bd-navbar">
7675
{%- include "sections/header.html" %}
77-
</div>
76+
</header>
7877
{% endblock docs_navbar %}
79-
</header>
8078

8179
<div class="bd-container">
8280
<div class="bd-container__inner bd-page-width">

tests/test_build.py

+7
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,13 @@ def test_logo_template_rejected(sphinx_build_factory) -> None:
307307
sphinx_build_factory("base", confoverrides=confoverrides).build()
308308

309309

310+
def test_sticky_header(sphinx_build_factory):
311+
"""Regression test, see #1630. Sticky header should be direct descendant of body."""
312+
sphinx_build = sphinx_build_factory("test_navbar_no_in_page_headers").build()
313+
index_html = sphinx_build.html_tree("index.html")
314+
assert index_html.select_one("body > .bd-header")
315+
316+
310317
@pytest.mark.parametrize(
311318
"align,klass",
312319
[

0 commit comments

Comments
 (0)