Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Search: Missing match highlights in search results #1676

Closed
michael-wisely-gravwell opened this issue Jan 22, 2024 · 2 comments · Fixed by #1678
Closed

Search: Missing match highlights in search results #1676

michael-wisely-gravwell opened this issue Jan 22, 2024 · 2 comments · Fixed by #1678

Comments

@michael-wisely-gravwell
Copy link
Contributor

The Problem

I recently migrated a project from pydata-sphinx-theme 0.11.0 to 0.15.2.

On 0.11.0, I was used to seeing the little match context with each page link featuring highlights on matches.

image

On 0.15.2, however, I don't see the match contexts at all, but I do see lot of errors logged by searchtools.js.

image

It would appear that searchtools.js is looking for an element with the selector [role="main"], and it's not finding it.

A Workaround

Adding this to my layout.html appears to fix the issue for me:

{% block docs_body %}
  {% include "components/searchbox.html" %}
  <article class="bd-article" role="main">
    {% block body %}{% endblock %}
  </article>
{% endblock docs_body %}

That said, I'm not totally certain if docs_body is the right place to put role="main". I decided to try adding it there because that's where it's located in v0.11.0

@drammock
Copy link
Collaborator

the role="main" was removed in #1454 for screen reader compatibility. @gabalafou can you look?

@gabalafou
Copy link
Collaborator

Thanks @michael-wisely-gravwell for submitting such a thorough issue (sorry for the turbulence!) and thanks @drammock for linking #1454. I've submitted a fix, #1678.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants