summaryrefslogtreecommitdiff
path: root/sphinx
diff options
context:
space:
mode:
authorTim Hoffmann <2836374+timhoffm@users.noreply.github.com>2023-04-21 03:02:04 +0200
committerGitHub <noreply@github.com>2023-04-21 02:02:04 +0100
commitb430e052858c490a4e90f3143f159ee6240eb948 (patch)
tree5e4ece131815c1fb12c8ed0f182f187c38a89d49 /sphinx
parente2f66cea4997b6d8c588d3509adb68d4e9108ee6 (diff)
downloadsphinx-git-b430e052858c490a4e90f3143f159ee6240eb948.tar.gz
Create a 'search field' component for themes (#11045)
``searchfield.html`` is similar to the existing ``searchbox.html``, but does not have the heading "Quick Search". Instead, it uses "Search" as a placeholder text. This gives a cleaner and less cluttered appearance. The searchfield component is added to the basic theme and thus can be used in any derivative theme. It is not used by default for backward compatibility. The searchfield compenent is made the default in the sphinx13 theme. CSS changes ensure that the top of the search field is aligned with the top of the main content.
Diffstat (limited to 'sphinx')
-rw-r--r--sphinx/themes/basic/searchfield.html23
1 files changed, 23 insertions, 0 deletions
diff --git a/sphinx/themes/basic/searchfield.html b/sphinx/themes/basic/searchfield.html
new file mode 100644
index 000000000..1286be021
--- /dev/null
+++ b/sphinx/themes/basic/searchfield.html
@@ -0,0 +1,23 @@
+{#
+ basic/searchfield.html
+ ~~~~~~~~~~~~~~~~~~~~~~
+
+ Sphinx sidebar template: search field.
+ This component is similar to searchbox.html but does not include an
+ extra heading ("Quick search"). Instead, it uses a placeholder text
+ in the search field.
+
+ :copyright: Copyright 2007-2022 by the Sphinx team, see AUTHORS.
+ :license: BSD, see LICENSE for details.
+#}
+{%- if pagename != "search" and builder != "singlehtml" %}
+<div id="searchbox" style="display: none" role="search">
+ <div class="searchformwrapper">
+ <form class="search" action="{{ pathto('search') }}" method="get">
+ <input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" placeholder="Search"/>
+ <input type="submit" value="{{ _('Go') }}" />
+ </form>
+ </div>
+</div>
+<script>document.getElementById('searchbox').style.display = "block"</script>
+{%- endif %}