Mercurial > gemma
changeset 965:ac2e51d5bc40
feat: autofocus when search expands
author | Thomas Junk <thomas.junk@intevation.de> |
---|---|
date | Wed, 17 Oct 2018 15:33:59 +0200 |
parents | 1e2dce348cfb |
children | 6114c512508b |
files | client/src/application/Topbar.vue |
diffstat | 1 files changed, 5 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/client/src/application/Topbar.vue Wed Oct 17 15:29:58 2018 +0200 +++ b/client/src/application/Topbar.vue Wed Oct 17 15:33:59 2018 +0200 @@ -108,6 +108,8 @@ import Identify from "../layers/Identify"; import Layers from "../layers/Layers"; +const setFocus = () => document.querySelector("#search").focus(); + export default { name: "topbar", components: { @@ -210,6 +212,9 @@ this.toggleSearchbar(); }, toggleSearchbar() { + if (this.searchbarCollapsed) { + setTimeout(setFocus, 300); + } this.searchbarCollapsed = !this.searchbarCollapsed; }, toggleSidebar() {