|
| 1 | +{% comment %} |
| 2 | + Header Search Bar — Gecko-powered search trigger with JS-disabled fallback. |
| 3 | + |
| 4 | + The search modal is imported from static/js/boost-gecko/. |
| 5 | + |
| 6 | + When JavaScript is enabled, the button opens the Gecko search overlay (wired |
| 7 | + in static/js/search-shortcut.js; Ctrl/Cmd+K shortcut). When JavaScript is |
| 8 | + disabled, the button and keyboard hint are hidden via an inline <style> in |
| 9 | + <noscript>, and a non-interactive span explains that search is unavailable. |
| 10 | + |
| 11 | + Variables: |
| 12 | + current_version (object, required) — current Boost release (from context processor) |
| 13 | + |
| 14 | + Usage: |
| 15 | + {% include "v3/includes/header/_header_search_bar.html" %} |
| 16 | +{% endcomment %} |
| 17 | +<search class="header__search-bar"> |
| 18 | + <button type="button" |
| 19 | + id="gecko-search-button" |
| 20 | + class="header__search-input-trigger" |
| 21 | + data-current-boost-version="{{ current_version.stripped_boost_url_slug }}" |
| 22 | + data-theme-mode="light" |
| 23 | + data-font-family="var(--font-sans)"> |
| 24 | + <span class="header__search-icon" aria-hidden="true"> |
| 25 | + {% include "includes/icon.html" with icon_name="search" icon_class="header__icon" icon_size=16 %} |
| 26 | + </span> |
| 27 | + Search |
| 28 | + </button> |
| 29 | + <span class="header__search-kbd" aria-hidden="true">CTRL+K</span> |
| 30 | + <noscript> |
| 31 | + <style> |
| 32 | + #gecko-search-button, |
| 33 | + .header__search-kbd { display: none; } |
| 34 | + .header__search-bar > noscript { display: contents; } |
| 35 | + </style> |
| 36 | + <span class="header__search-input-trigger" aria-disabled="true"> |
| 37 | + <span class="header__search-icon" aria-hidden="true"> |
| 38 | + {% include "includes/icon.html" with icon_name="search" icon_class="header__icon" icon_size=16 %} |
| 39 | + </span> |
| 40 | + Search is not available with JS disabled |
| 41 | + </span> |
| 42 | + </noscript> |
| 43 | +</search> |
0 commit comments