diff --git a/members/static/members/js/tab.js b/members/static/members/js/tab.js index 86e5b693..b337d04e 100644 --- a/members/static/members/js/tab.js +++ b/members/static/members/js/tab.js @@ -13,7 +13,8 @@ document.addEventListener("DOMContentLoaded", function(event) { const urlFragment = window.location.hash.substring(1); // Remove the '#' char // Default to the first list item as active if the ID is not provided or doesn't match any item - const activeIndex = tabButtons.findIndex(button => button.id === urlFragment); + // we use custom attribute data-navigation to set the "navigation url" for tab + const activeIndex = tabButtons.findIndex(button => button.dataset.navigation === urlFragment); const defaultIndex = activeIndex !== -1 ? activeIndex : 0; // Default to first as active @@ -38,6 +39,9 @@ function toggleActive(sections, buttons, activeIndex) { sections[activeIndex].hidden = false; // set url to include the tab identifier. we overwrite url, since tabs doesn't work otherwise - const newUrl = window.location.pathname + `#${buttons[activeIndex].id}`; - window.history.replaceState({}, "", newUrl); + // we use custom attribute data-navigation to set the url for tab + if (buttons[activeIndex].dataset.navigation) { + const newUrl = window.location.pathname + `#${buttons[activeIndex].dataset.navigation}`; + window.history.replaceState({}, "", newUrl); + } } diff --git a/members/templates/members/activities.html b/members/templates/members/activities.html index be347182..1735bbe2 100644 --- a/members/templates/members/activities.html +++ b/members/templates/members/activities.html @@ -15,11 +15,11 @@