mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-07-17 13:09:49 -04:00
If there is a search term when the page loads, a statement about the results is added to the searchbox label. All subsequent searches are announced via an aria live-region.
22 lines
678 B
HTML
22 lines
678 B
HTML
{% from "components/textbox.html" import textbox %}
|
|
|
|
{% macro live_search(
|
|
target_selector=None,
|
|
show=False,
|
|
form=None,
|
|
label=None
|
|
) %}
|
|
{%- set search_label = label or form.search.label.text %}
|
|
{% if show %}
|
|
<div data-module="autofocus">
|
|
<div class="live-search js-header" data-module="live-search" data-targets="{{ target_selector }}">
|
|
{{ form.search(param_extensions={
|
|
"label": {"text": search_label},
|
|
"autocomplete": "off"
|
|
}) }}
|
|
<div role="region" aria-live="polite" class="live-search__status govuk-visually-hidden"></div>
|
|
</div>
|
|
</div>
|
|
{% endif %}
|
|
{% endmacro %}
|