Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions python/packages/autogen-core/docs/src/_static/custom.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,42 @@ document.addEventListener('DOMContentLoaded', function() {
});
});
});

// Set active TOCtree elements with aria-current=page
document.querySelectorAll('.bd-sidenav .active').forEach(function(element) {
element.setAttribute('aria-current', 'page');
});

// Set secondary navbar (in-page nagivation) active element with aria-current=page
document.addEventListener("activate.bs.scrollspy", function () {
const navLinks = document.querySelectorAll(".bd-toc-nav a");

navLinks.forEach((navLink) => {
navLink.parentElement.removeAttribute('aria-current');
});

const activeNavLinks = document.querySelectorAll(".bd-toc-nav a.active");
activeNavLinks.forEach((navLink) => {
navLink.parentElement.setAttribute('aria-current', 'page');
});
});

// Version dropdown menu is dynamically generated after page load. Listen for changes to set aria-selected
var observer = new MutationObserver(function() {
document.querySelectorAll('.dropdown-item').forEach(function(element) {
if (element.classList.contains('active')) {
element.setAttribute('aria-selected', 'true');
}
});
});

// Observe changes in the version-switcher__menu element
var targetNode = document.querySelector('.version-switcher__menu');
var config = { childList: true, subtree: true };

if (targetNode) {
observer.observe(targetNode, config);
}
});

async function copyToClipboard(button) {
Expand Down
Loading