tabSelect: skip selection from fragment if error is displayed (#81867)
gitea/gadjo/pipeline/head This commit looks good Details

This commit is contained in:
Paul Marillonnet 2023-10-02 15:02:06 +02:00
parent f6dfb7a3f8
commit fb69e7be05
1 changed files with 7 additions and 2 deletions

View File

@ -359,8 +359,13 @@ var gadjo_js = gadjo_js || {};
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) {
/* if no error to be displayed, focus tab from #open:<tab slug> anchor, to point to open panel */
/* when an error is to be displayed, let the template decide which tab is selected; do nothing here */
if (
!document.querySelector('.pk-tabs--container').getElementsByClassName('errornotice').length
&& 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]);