Add code to auto select tabs

This commit is contained in:
2025-01-11 13:03:27 -05:00
parent a8cd90c349
commit b5e0061247
4 changed files with 52 additions and 1 deletions

View File

@@ -10,6 +10,7 @@ const click = new MouseEvent('click', {
});
export function init(p = document, s = true) {
p.querySelectorAll(".tab-group, tabset").forEach(tabGroup => {
if (tabGroup.querySelector("[role=tablist]") === null) {
@@ -62,5 +63,9 @@ export function init(p = document, s = true) {
})
});
}
if (document.location.hash != "" && document.location.hash.substring(0,5) == "#tab-") {
document.querySelector(document.location.hash).dispatchEvent(click);
}
});
}