Skip to content

Commit

Permalink
Add listener on cloned button
Browse files Browse the repository at this point in the history
  • Loading branch information
philippjfr committed Oct 1, 2024
1 parent 279d93d commit 8e21b5d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions doc/_static/toggle.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
function clone(node) {
var new_element = node.cloneNode(true);
node.parentNode.replaceChild(new_element, node);
return new_element
}

function documentReady(callback) {
Expand Down Expand Up @@ -39,8 +40,8 @@ function setupMobileSidebarKeyboardHandlers() {
if (!clickTransmitter) {
return;
}
clone(clickTransmitter)
clickTransmitter.addEventListener("click", (event) => {
const cloned = clone(clickTransmitter)
cloned.addEventListener("click", (event) => {
event.preventDefault();
event.stopPropagation();
toggle.checked = !toggle.checked;
Expand Down

0 comments on commit 8e21b5d

Please sign in to comment.