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

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