{# Search Modal Component (Cmd/Ctrl+K) A command-palette style search modal for quick documentation access. Features: - Cmd/Ctrl+K keyboard shortcut to open - Escape to close - Recent searches (localStorage) - Keyboard navigation (↑↓ to navigate, Enter to select) - Focus trap for accessibility - Lazy loads search index on first open Dependencies: - JavaScript: /assets/js/core/search.js (consolidated search module) - CSS: /assets/css/components/search-modal.css - Search: BengalSearch module (core/search.js) Configuration: search: ui: modal: true recent_searches: 5 Usage: {% include 'partials/search-modal.html' %} #} {# Only render if modal is enabled #} {% let search_config = config?.search %} {% let ui_config = search_config?.ui ?? {} %} {% let modal_enabled = ui_config?.modal ?? false %} {% if modal_enabled %} {# Backdrop for clicking outside to close #}
{# Modal container — the native opened via showModal() already carries modal semantics, so no nested role=dialog/aria-modal here. #}
{# Header with search input #}
{{ icon('magnifying-glass', size=20, css_class='search-modal__icon') }}
{# Status for screen readers #}
{# Scope chips — filter results to Docs / API / Releases. The active chip carries aria-pressed=true; "All" is the default. JS re-runs the current query on chip change (search.js). Mirrors the /search filter affordance. #}
{# Recent searches section #}
{{ t('search.recent', default='Recent') }}
    {# Recent searches populated by JS #}
{# Search results #}
{# Results populated by JS #}
{# No results message #} {# Empty state (before search) — first-open suggestions the JS binds. #}

{{ t('search.empty_hint', default='Start typing to search...') }}

{% let modal_suggestions = ui_config?.suggestions ?? ['button', 'card', 'modal', 'tabs', 'theming', 'layout'] %}
{{ t('search.popular', default='Popular searches') }}
{% for term in modal_suggestions %} {% end %}
{# Footer with keyboard hints #}
{{ t('search.hint_navigate', default='Navigate') }} {{ t('search.hint_open', default='Open') }} ESC {{ t('search.hint_close', default='Close') }}
{{ t('search.powered_by', default='Powered by') }} Lunr
{# The Cmd/Ctrl+K palette is JS-driven; without JS, point to the full search page, which renders a server-side list of every indexed page. #} {% end %}