js: focus tab according to anchor in URL (#68102)

This commit is contained in:
Valentin Deniaud 2022-08-10 16:35:14 +02:00
parent 40114f3665
commit c5c4772c5e
1 changed files with 8 additions and 0 deletions

View File

@ -356,6 +356,14 @@ var gadjo_js = gadjo_js || {};
$(document.querySelectorAll('.pk-tabs')).each(function(i, el) {
el.tabs = new gadjo_js.Tabs(el);
});
/* focus tab from #open:<tab slug> anchor, to point to open panel */
if (document.location.hash && document.location.hash.indexOf('#open:') == 0) {
const $tab_button = $('#tab-' + document.location.hash.substring(6) + '[role=tab]');
if ($tab_button.length) {
$tab_button.parents('.pk-tabs')[0].tabs.selectTab($tab_button[0]);
}
}
});
var storage = undefined;