diff --git a/ui/index.html b/ui/index.html index 903444d4..88457d35 100644 --- a/ui/index.html +++ b/ui/index.html @@ -1424,11 +1424,13 @@ function refreshTagsList() { editorModifierTagsList.appendChild(tag.element); tag.element.addEventListener('click', () => { - if (index !== -1) { - activeTags[index].originElement.classList.remove(activeCardClass); - activeTags[index].originElement.querySelector('.modifier-card-image-overlay').innerText = '+'; + let idx = activeTags.indexOf(tag); - activeTags.splice(index, 1); + if (idx !== -1) { + activeTags[idx].originElement.classList.remove(activeCardClass); + activeTags[idx].originElement.querySelector('.modifier-card-overlay').innerText = '+'; + + activeTags.splice(idx, 1); refreshTagsList(); } });