Skip to content

Commit e01d914

Browse files
jdknighttk0miya
authored andcommitted
themes: use noscript for search js notification
The "search.html" template will generate a warning admonition about requiring JavaScript for search and automatically hiding the element when supported. While functional, if a client renders the page slowly, the warning notification may be visible to the user for a moment. Instead of relying on JavaScript to suppress this warning, use a `noscript` tag to hide the warning for clients who do not support JavaScript. This also has the benefit of one less JavaScript call required by a client. Signed-off-by: James Knight <[email protected]>
1 parent 293beec commit e01d914

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

sphinx/themes/basic/search.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,14 @@
2121
{% block body %}
2222
<h1 id="search-documentation">{{ _('Search') }}</h1>
2323
{% block scriptwarning %}
24-
<div id="fallback" class="admonition warning">
25-
<script>$('#fallback').hide();</script>
24+
<noscript>
25+
<div class="admonition warning">
2626
<p>
2727
{% trans %}Please activate JavaScript to enable the search
2828
functionality.{% endtrans %}
2929
</p>
3030
</div>
31+
</noscript>
3132
{% endblock %}
3233
{% block searchtext %}
3334
<p>

0 commit comments

Comments
 (0)