Skip to content

Commit

Permalink
fix long click
Browse files Browse the repository at this point in the history
  • Loading branch information
lekoala committed Dec 13, 2021
1 parent ec468ec commit 76ad63e
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bootstrap5-tags",
"version": "1.2.0",
"version": "1.2.1",
"description": "Replace select[multiple] with nices badges",
"main": "tags",
"scripts": {
Expand Down
8 changes: 8 additions & 0 deletions tags.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,9 @@ class Tags {
}
});
this.searchInput.addEventListener("focusout", (event) => {
if(this.clicked) {
return;
}
setTimeout(function () {
self.hideSuggestions();
}, 100);
Expand Down Expand Up @@ -308,11 +311,16 @@ class Tags {
this.keyboardNavigation = false;
});

newChildLink.addEventListener("mousedown", (event) => {
event.preventDefault();
this.clicked = true;
});
newChildLink.addEventListener("click", (event) => {
event.preventDefault();
this.addItem(newChildLink.innerText, newChildLink.getAttribute(VALUE_ATTRIBUTE));
this.resetSearchInput();
this.hideSuggestions();
this.clicked = false;
});
}
}
Expand Down
2 changes: 1 addition & 1 deletion tags.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 76ad63e

Please sign in to comment.