Et2Tabs: Better handling of fallback tab sizing

Now considering tab may be bigger than parent
This commit is contained in:
nathan 2024-08-14 12:57:44 -06:00
parent 042c539438
commit 5314a091a0

View File

@ -235,10 +235,11 @@ export class Et2Tabs extends Et2InputWidget(SlTabGroup) implements et2_IResizeab
} }
walk(firstTab); walk(firstTab);
await Promise.all(wait); await Promise.all(wait);
const maxHeight = getComputedStyle(this.shadowRoot.querySelector('.tab-group__body')).height;
const initial = firstTab.hasAttribute("active"); const initial = firstTab.hasAttribute("active");
firstTab.setAttribute("active", ''); firstTab.setAttribute("active", '');
this.tabHeight = getComputedStyle(firstTab).height; const tabHeight = getComputedStyle(firstTab).height;
this.tabHeight = maxHeight != '0px' && parseInt(maxHeight) < parseInt(tabHeight) ? maxHeight : tabHeight;
if(!initial) if(!initial)
{ {
firstTab.removeAttribute("active"); firstTab.removeAttribute("active");