Keep search open on enter without selection

This commit is contained in:
Lukas Geiter 2017-10-12 16:04:48 +02:00 committed by Martin Donath
parent a267729084
commit 253596c58d
4 changed files with 10 additions and 9 deletions

View File

@ -39,7 +39,7 @@
<script src="{{ base_url }}/assets/javascripts/modernizr-e826f8942a.js"></script> <script src="{{ base_url }}/assets/javascripts/modernizr-e826f8942a.js"></script>
{% endblock %} {% endblock %}
{% block styles %} {% block styles %}
<link rel="stylesheet" href="{{ base_url }}/assets/stylesheets/application-9011e2d3f8.css"> <link rel="stylesheet" href="{{ base_url }}/assets/stylesheets/application-4d315b386e.css">
{% if config.extra.palette %} {% if config.extra.palette %}
<link rel="stylesheet" href="{{ base_url }}/assets/stylesheets/application-23f75ab9c7.palette.css"> <link rel="stylesheet" href="{{ base_url }}/assets/stylesheets/application-23f75ab9c7.palette.css">
{% endif %} {% endif %}
@ -153,7 +153,7 @@
{% endblock %} {% endblock %}
</div> </div>
{% block scripts %} {% block scripts %}
<script src="{{ base_url }}/assets/javascripts/application-f3ab9e5ff8.js"></script> <script src="{{ base_url }}/assets/javascripts/application-683e1b679e.js"></script>
{% set languages = lang.t("search.languages").split(",") %} {% set languages = lang.t("search.languages").split(",") %}
{% if languages | length and languages[0] != "" %} {% if languages | length and languages[0] != "" %}
{% set path = base_url + "/assets/javascripts/lunr" %} {% set path = base_url + "/assets/javascripts/lunr" %}

View File

@ -290,13 +290,14 @@ function initialize(config) { // eslint-disable-line func-style
/* Go to current active/focused link */ /* Go to current active/focused link */
const focus = document.querySelector( const focus = document.querySelector(
"[data-md-component=search] [href][data-md-state=active]") "[data-md-component=search] [href][data-md-state=active]")
if (focus instanceof HTMLLinkElement) if (focus instanceof HTMLLinkElement) {
window.location = focus.getAttribute("href") window.location = focus.getAttribute("href")
/* Close search */ /* Close search */
toggle.checked = false toggle.checked = false
toggle.dispatchEvent(new CustomEvent("change")) toggle.dispatchEvent(new CustomEvent("change"))
query.blur() query.blur()
}
} }
/* Escape: close search */ /* Escape: close search */