Fix adding empty tag on focus out from element
For some reason, i was looking at the value of the focus’ **target**, which is not my search field at all, but whatever control the focus changes **to**. It that new control is an input with value, then it created a new tag with whatever my search field had, which could be the empty string.
This commit is contained in:
parent
33277454fa
commit
3b568b013f
|
@ -345,7 +345,7 @@ class Tags extends HTMLDivElement {
|
|||
this.search.addEventListener('keydown', this.onSearchKeydownHandler);
|
||||
this.onFocusOutHandler = (e) => {
|
||||
if (this.contains(e.target)) return;
|
||||
if (e.target.value && e.target.value.trim() !== '') {
|
||||
if (this.search.value && this.search.value.trim() !== '') {
|
||||
this.createTag();
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue