js: adjust URL to mention selected tab (#68135)

This commit is contained in:
Frédéric Péters 2022-08-11 22:21:12 +02:00
parent 7ca220b9bf
commit 40114f3665
1 changed files with 5 additions and 0 deletions

View File

@ -341,6 +341,11 @@ var gadjo_js = gadjo_js || {};
.querySelector('#' + btn.getAttribute('aria-controls'))
.hidden = false;
// Adjust URL to mention selected tab
const url = new URL(document.location);
url.hash = '#open:' + btn.getAttribute('aria-controls').substring(6);
history.replaceState(null, '', url);
// Trigger gadjo:tab-selected event on panel
$(this.parent.querySelector('#' + btn.getAttribute('aria-controls'))).trigger('gadjo:tab-selected');
return false;