Skip to content

Commit 9f24338

Browse files
authored
fix(tab): make auto activation of tabs optional
The implemented auto activation of tabs when no active tab is found lead into some situations where a manual set of the active tab does not work anymore and always the last tab was selected. This especially happens when tabs are initialized separately. Such situations need the old until FUI 2.7.7 which did not check for existing active tabs at all This PR adds a new option autoTabActivation (default true to avoid being a breaking change within the 2.8.x branch) When set to false the behavior is the same as until 2.7.7 When set to a string and no active tab exists, it will use that string as the path name for the tab to be activated.
1 parent 8621c99 commit 9f24338

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/definitions/modules/tab.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,9 @@ $.fn.tab = function(parameters) {
100100
initializedHistory = true;
101101
}
102102

103-
if(instance === undefined && module.determine.activeTab() == null) {
103+
if(settings.autoTabActivation && instance === undefined && module.determine.activeTab() == null) {
104104
module.debug('No active tab detected, setting first tab active', module.get.initialPath());
105-
module.changeTab(module.get.initialPath());
105+
module.changeTab(settings.autoTabActivation === true ? module.get.initialPath() : settings.autoTabActivation);
106106
};
107107

108108
module.instantiate();
@@ -953,6 +953,7 @@ $.fn.tab.settings = {
953953

954954
apiSettings : false, // settings for api call
955955
evaluateScripts : 'once', // whether inline scripts should be parsed (true/false/once). Once will not re-evaluate on cached content
956+
autoTabActivation: true, // whether a non existing active tab will auto activate the first available tab
956957

957958
onFirstLoad : function(tabPath, parameterArray, historyEvent) {}, // called first time loaded
958959
onLoad : function(tabPath, parameterArray, historyEvent) {}, // called on every load

0 commit comments

Comments
 (0)