Browser: Brave 1.63
OS: macOS
URL: Diary – sounddiary.me
I don’t remember when, but at some point my .brxe-toggle elements stopped working correctly (see the menu bar on the upper right – the burger as well as the filter and hashtag icons).
I am not sure if wpgridbuilder or bricks is the problem here, but the fact is, that when I load new content with the lazy load function of wpgridbuilder, bricksToggle() will fire again causing every .brxe-toggle element to have 2 of the same click events. Of course the functionality therefore stops working.
When I add a toggleCounter variable I can prevent the events from being attached twice. Of course this will be overridden in the next update and is far from ideal:
var toggleCounter = 0;
function bricksToggle() {
if (bricksIsFrontend) {
var e = bricksQuerySelectorAll(document, “.brxe-toggle”);
toggleCounter++;
if(toggleCounter === 1){
e.length && (bricksToggleDisplay(), e.forEach((function(e) {
e.addEventListener(“click”, (function(t) {
var n, r, i;
t.preventDefault();
var o = (null === (n = e.dataset) || void 0 === n ? void 0 : n.selector) || “.brxe-offcanvas”,
a = (null === (r = e.dataset) || void 0 === r ? void 0 : r.attribute) || “class”,
s = (null === (i = e.dataset) || void 0 === i ? void 0 : i.value) || “brx-open”,
c = !!o && document.querySelector(o);
if (c || (c = e.closest(“.brxe-nav-nested”)), c || (c = e.closest(“.brxe-offcanvas”)), c) {
document.querySelector(“.brx-has-megamenu”) && (t.target.closest(‘[data-effect=“offset”]’) || bricksSubmenuPosition(0)), e.dataset.scriptId && !c.dataset.toggleScriptId && (c.dataset.toggleScriptId = e.dataset.scriptId);
var l = “true” === e.getAttribute(“aria-expanded”);
e.setAttribute(“aria-expanded”, !l), e.classList.toggle(“is-active”), “class” === a ? e.closest(“.brxe-nav-nested”) && “brx-open” === s && c.classList.contains(“brx-open”) ? (c.classList.add(“brx-closing”), setTimeout((function() {
c.classList.remove(“brx-closing”), c.classList.remove(“brx-open”)
}), 200)) : c.classList.toggle(s) : c.getAttribute(a) ? c.removeAttribute(a) : c.setAttribute(a, s);
var d = bricksGetFocusables(c);
d.length && d[0].focus()
}
}))
})))
}
}
}