Skip to content

Commit

Permalink
Fix sticky header (#1630)
Browse files Browse the repository at this point in the history
* Fix sticky header

* regression test
  • Loading branch information
gabalafou committed Jan 8, 2024
1 parent c25f233 commit 1b599c4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/pydata_sphinx_theme/theme/pydata_sphinx_theme/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -67,16 +67,14 @@
<div class="search-button__search-container">{% include "../components/search-field.html" %}</div>
</div>

<header>
{%- if theme_announcement -%}
{% include "sections/announcement.html" %}
{%- endif %}
{% block docs_navbar %}
<div class="bd-header navbar navbar-expand-lg bd-navbar">
<header class="bd-header navbar navbar-expand-lg bd-navbar">
{%- include "sections/header.html" %}
</div>
</header>
{% endblock docs_navbar %}
</header>

<div class="bd-container">
<div class="bd-container__inner bd-page-width">
Expand Down
7 changes: 7 additions & 0 deletions tests/test_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,13 @@ def test_logo_template_rejected(sphinx_build_factory) -> None:
sphinx_build_factory("base", confoverrides=confoverrides).build()


def test_sticky_header(sphinx_build_factory):
"""Regression test, see #1630. Sticky header should be direct descendant of body."""
sphinx_build = sphinx_build_factory("test_navbar_no_in_page_headers").build()
index_html = sphinx_build.html_tree("index.html")
assert index_html.select_one("body > .bd-header")


@pytest.mark.parametrize(
"align,klass",
[
Expand Down

0 comments on commit 1b599c4

Please sign in to comment.