Skip to content

Commit

Permalink
Maintain aria-expanded along with .current in menu
Browse files Browse the repository at this point in the history
Use jquery setter chaining for speed
  • Loading branch information
jonels-msft committed Jun 21, 2021
1 parent ef9a058 commit 55573d5
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/theme.js
Expand Up @@ -145,11 +145,19 @@ function ThemeNav () {
// If we found a matching link then reset current and re-apply
// otherwise retain the existing match
if (link.length > 0) {
$('.wy-menu-vertical .current').removeClass('current');
link.addClass('current');
link.closest('li.toctree-l1').parent().addClass('current');
$('.wy-menu-vertical .current')
.removeClass('current')
.attr('aria-expanded','false');
link.addClass('current')
.attr('aria-expanded','true');
link.closest('li.toctree-l1')
.parent()
.addClass('current')
.attr('aria-expanded','true');
for (let i = 1; i <= 10; i++) {
link.closest('li.toctree-l' + i).addClass('current');
link.closest('li.toctree-l' + i)
.addClass('current')
.attr('aria-expanded','true');
}
link[0].scrollIntoView();
}
Expand Down

0 comments on commit 55573d5

Please sign in to comment.