From ba880c656037a0118ccb59262d14583a734b33d5 Mon Sep 17 00:00:00 2001 From: jordi fita mas Date: Sat, 8 Apr 2023 21:27:40 +0200 Subject: [PATCH] Create the tag when focusing out of the input This is mainly because i sometimes think that the tag is accepted just because it is there in the input, but actually it is not being used at all. I fear more people would do the same mistake. --- web/static/numerus.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/web/static/numerus.js b/web/static/numerus.js index 3aea63b..86b7c23 100644 --- a/web/static/numerus.js +++ b/web/static/numerus.js @@ -339,6 +339,12 @@ class Tags extends HTMLDivElement { break; } }); + window.addEventListener('focusin', (e) => { + if (this.contains(e.target)) return; + if (e.target.value.trim() !== '') { + this.createTag(); + } + }); // Must come after the search input this.tagList.append(this.label);