Focus search after reset

This commit is contained in:
squidfunk
2017-03-21 15:27:45 +01:00
committed by Martin Donath
parent a2ff177885
commit 50efda702a
17 changed files with 97 additions and 53 deletions

View File

@@ -172,6 +172,16 @@ function initialize(config) { // eslint-disable-line func-style
}
}))
/* Listener: focus input after form reset */
new Material.Event.Listener("[data-md-component=reset]", "click", () => {
setTimeout(() => {
const query = document.querySelector("[data-md-component=query]")
if (!(query instanceof HTMLInputElement))
throw new ReferenceError
query.focus()
}, 10)
}).listen()
/* Listener: focus input after opening search */
new Material.Event.Listener("[data-md-toggle=search]", "change", ev => {
setTimeout(toggle => {