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.
This commit is contained in:
jordi fita mas 2023-04-08 21:27:40 +02:00
parent bc48dd4089
commit ba880c6560
1 changed files with 6 additions and 0 deletions

View File

@ -339,6 +339,12 @@ class Tags extends HTMLDivElement {
break; break;
} }
}); });
window.addEventListener('focusin', (e) => {
if (this.contains(e.target)) return;
if (e.target.value.trim() !== '') {
this.createTag();
}
});
// Must come after the search input // Must come after the search input
this.tagList.append(this.label); this.tagList.append(this.label);