I had issues getting event.stopPropagation()
working. If you do too, try moving it to the top of your click handler function, that was what I needed to do to stop the event from bubbling. Example function:
toggleFilter(e) {
e.stopPropagation(); // If moved to the end of the function, will not work
let target = e.target;
let i = 10; // Sanity breaker
while(true) {
if (--i === 0) { return; }
if (target.classList.contains("filter")) {
target.classList.toggle("active");
break;
}
target = target.parentNode;
}
}