Skip to content

Commit

Permalink
fix(tab): make auto activation of tabs optional
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
lubber-de authored May 31, 2020
1 parent 8621c99 commit 9f24338
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/definitions/modules/tab.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,9 @@ $.fn.tab = function(parameters) {
initializedHistory = true;
}

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

module.instantiate();
Expand Down Expand Up @@ -953,6 +953,7 @@ $.fn.tab.settings = {

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

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

0 comments on commit 9f24338

Please sign in to comment.