Skip to content

Commit

Permalink
Fix accordion js (#1501)
Browse files Browse the repository at this point in the history
Fix #1237 by regex matching for specific hash pattern and checking if the result is a DOM element.
  • Loading branch information
bwbroersma authored Sep 19, 2024
1 parent 46b4042 commit 1368a1e
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions frontend/js/accordion.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@
$('.pre-icon', this).text(opentext);
});

var hash = window.location.hash;
if (hash!='') {
$(hash).attr( 'aria-expanded' , true ).addClass( 'active' ).parent().next( '.panel-content' ).slideDown(200).attr( 'aria-hidden' , 'false');
setPanelItemFoldText($('.pre-icon', hash), 'close');
refreshPanelButtonText($(hash), 'open');
var cphashmatch = /^#control-panel-[0-9]+/.exec(window.location.hash);
if (cphashmatch && $(cphashmatch[0]).length) {
$(cphashmatch[0]).attr( 'aria-expanded' , true ).addClass( 'active' ).parent().next( '.panel-content' ).slideDown(200).attr( 'aria-hidden' , 'false');
setPanelItemFoldText($('.pre-icon', cphashmatch[0]), 'close');
refreshPanelButtonText($(cphashmatch[0]), 'open');
}

// Now we can play with it
Expand Down

0 comments on commit 1368a1e

Please sign in to comment.