Skip to content

Commit

Permalink
Add debug console.log() messages
Browse files Browse the repository at this point in the history
  • Loading branch information
Mandrenkov committed Oct 10, 2023
1 parent ab54b96 commit 24daec4
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions xanadu_sphinx_theme/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,7 @@
<!-- Utility functions for setting ARIA attributes on buttons that show menus. -->
<script type="text/javascript">
function setAriaAttributes(button, expand) {
console.log("setAriaAttributes()", button, expand);
const skip = button.ariaLabel.indexOf(" ");
const menu = button.ariaLabel.substr(skip);
button.ariaLabel = (expand ? "close" : "open") + menu;
Expand All @@ -444,10 +445,12 @@
const button = link.querySelector("button");
if (dropdown !== null) {
timers[i] = {link: link, button: button, timeout: undefined};
console.log("for", i, timers[i]);

// Expands the current dropdown and closes other dropdowns.
const expandDropdown = () => {
for (const [j, timer] of Object.entries(timers)) {
console.log("expandDropdown()", i, j, timer);
clearTimeout(timer.timeout);
if (i !== j) {
timer.link.classList.remove("open");
Expand All @@ -461,6 +464,7 @@
// Closes the current dropdown after the given delay.
const collapseDropdown = (event, delay = 1000) => {
timers[i].timeout = setTimeout(function(event){
console.log("collapseDropdown()", i, link, button, timers[i].timeout);
link.classList.remove("open");
setAriaAttributes(button, false);
}, delay);
Expand Down

0 comments on commit 24daec4

Please sign in to comment.