diff --git a/src/search/search.py b/src/search/search.py index 126c5bf11..64754f2ca 100644 --- a/src/search/search.py +++ b/src/search/search.py @@ -110,7 +110,9 @@ def search(self, query, *args, **kwargs): return self._wagtail_search(queryset, query, *args, **kwargs) def autocomplete(self, query, *args, **kwargs): - return self._wagtail_autocomplete(self.get_queryset(), query, *args, **kwargs) + # never show inactive profiles on autocomplete + queryset = Person.objects.all().active() + return self._wagtail_autocomplete(queryset, query, *args, **kwargs) class TeamsSearchVector(SearchVector): diff --git a/src/search/templates/search/partials/search_form.html b/src/search/templates/search/partials/search_form.html index 69b454f8c..3d7739347 100644 --- a/src/search/templates/search/partials/search_form.html +++ b/src/search/templates/search/partials/search_form.html @@ -9,9 +9,11 @@ placeholder="{{ placeholder|default:'Search site' }}" type="search" value="{{ search_query|default:'' }}" - hx-trigger="keyup changed delay:250ms" + hx-trigger="input keyup changed delay:150ms" hx-get="{% url 'search:autocomplete' %}" - hx-target="#autocomplete-results"> + hx-target="#autocomplete-results" + onblur="document.getElementById('autocomplete-results').style.display='none'" + onfocus="document.getElementById('autocomplete-results').style.display='block'">