Skip to content

Commit 5b9f8aa

Browse files
committed
fix a recursion bug in the tabsyncing
1 parent 0a65384 commit 5b9f8aa

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

docs/tabsync.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ document.addEventListener("DOMContentLoaded", function () {
44

55
for (const tab of tabs) {
66
tab.addEventListener("click", () => {
7+
if (tab.dataset.syncing === "true") return;
8+
79
const currentLabel = document.querySelector(`label[for="${tab.id}"]`);
810
if (!currentLabel) return;
911

@@ -19,7 +21,9 @@ document.addEventListener("DOMContentLoaded", function () {
1921
const inputId = label.getAttribute("for");
2022
const input = document.getElementById(inputId);
2123
if (input && input !== tab) {
24+
input.dataset.syncing = "true";
2225
input.click();
26+
input.dataset.syncing = "false";
2327
}
2428
}
2529
}

0 commit comments

Comments
 (0)