From b09550a522aad6a745997df74b42b09d2da22447 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Ku=C5=BE=C3=ADlek?= Date: Tue, 17 Mar 2020 01:43:13 +0100 Subject: [PATCH] Tag input autofocus on click --- yadc/assets/js/taginput.js | 4 ++++ yadc/static/all.js | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/yadc/assets/js/taginput.js b/yadc/assets/js/taginput.js index 7ab3694..81d6145 100644 --- a/yadc/assets/js/taginput.js +++ b/yadc/assets/js/taginput.js @@ -101,6 +101,8 @@ taginputs.forEach(function (tinput) { newtag.addEventListener('click', (event) => { remove_selected(event.target.dataset.tagname) // console.log(`Deselected: ${event.target.dataset.tagname}`) + + setTimeout(() => suggest_input.focus(), 2) }) sel.appendChild(newtag) @@ -128,6 +130,8 @@ taginputs.forEach(function (tinput) { element.addEventListener('click', (event) => { add_selected(event.target.dataset.tagname) event.preventDefault() + + setTimeout(() => suggest_input.focus(), 2) }) }) } diff --git a/yadc/static/all.js b/yadc/static/all.js index 8dd5ae6..553f8b4 100644 --- a/yadc/static/all.js +++ b/yadc/static/all.js @@ -158,6 +158,8 @@ taginputs.forEach(function (tinput) { newtag.addEventListener('click', (event) => { remove_selected(event.target.dataset.tagname) // console.log(`Deselected: ${event.target.dataset.tagname}`) + + setTimeout(() => suggest_input.focus(), 2) }) sel.appendChild(newtag) @@ -185,6 +187,8 @@ taginputs.forEach(function (tinput) { element.addEventListener('click', (event) => { add_selected(event.target.dataset.tagname) event.preventDefault() + + setTimeout(() => suggest_input.focus(), 2) }) }) }