Skip to content

Commit

Permalink
Restore search snippet highlights in search results page (pydata#1678)
Browse files Browse the repository at this point in the history
  • Loading branch information
gabalafou authored and ivanov committed Jun 4, 2024
1 parent 3b55d01 commit e14c267
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
{% include "sections/sidebar-primary.html" %}
</div>
{# Using an ID here so that the skip-link works #}
<main id="main-content" class="bd-main">
<main id="main-content" class="bd-main" role="main">
{# Main content area #}
{% block docs_main %}
<div class="bd-content">
Expand Down
9 changes: 9 additions & 0 deletions tests/test_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -1164,3 +1164,12 @@ def test_render_secondary_sidebar_dict_multiple_glob_matches(
assert not sphinx_build.html_tree("section1/index.html").select("div.sourcelink")
assert sphinx_build.html_tree("section2/index.html").select("div.sourcelink")
assert sphinx_build.html_tree("section2/page1.html").select("div.sourcelink")


def test_role_main_for_search_highlights(sphinx_build_factory):
"""Sphinx searchtools.js looks for [role="main"], so make sure it's there.
This is a regression test. See #1676.
"""
sphinx_build = sphinx_build_factory("base").build()
assert sphinx_build.html_tree("index.html").select_one('[role="main"]')

0 comments on commit e14c267

Please sign in to comment.