Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions static/js/tabpane-persist.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,28 @@ const _tdStoragePersistKey = (tabKey) =>

const _tdSupportsLocalStorage = () => typeof Storage !== 'undefined';

function adjustTabContentHeights() {
const contentTabs = document.querySelectorAll('.tab-content');

// Loop through each tabpane
contentTabs.forEach(contentTab => {
let maxHeight = 0;
const tabPanes = contentTab.querySelectorAll('.tab-pane');

// Loop through each tab in the tabpanes list to find max
tabPanes.forEach(tab => {
tab.style.display = 'block';
maxHeight = Math.max(maxHeight, tab.clientHeight);
tab.style.display = '';
});

// Loop through each tab in the tabpanes list to set height
tabPanes.forEach(tab => {
tab.style.height = maxHeight + 'px';
});
});
}

// Helpers

function tdPersistKey(key, value) {
Expand Down Expand Up @@ -93,6 +115,9 @@ function tdGetAndActivatePersistedTabs(tabs) {
tdActivateTabsWithKey(key);
});

// Adjust tab content heights
adjustTabContentHeights();

return key_ageList;
}

Expand Down