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:
parent
bc48dd4089
commit
ba880c6560
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue