From 886de143d46cd5506dd6c11b2e9aeb392c7abf9b Mon Sep 17 00:00:00 2001 From: nathan Date: Mon, 3 Apr 2023 11:57:57 -0600 Subject: [PATCH] Fix "Uncaught (in promise) TypeError: Failed to execute 'observe' on 'ResizeObserver': parameter 1 is not of type 'Element'." --- .../etemplate/Layout/Et2Tabs/Et2TabsMobile.ts | 42 ++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/api/js/etemplate/Layout/Et2Tabs/Et2TabsMobile.ts b/api/js/etemplate/Layout/Et2Tabs/Et2TabsMobile.ts index 2754fefc2c..602266bbf9 100644 --- a/api/js/etemplate/Layout/Et2Tabs/Et2TabsMobile.ts +++ b/api/js/etemplate/Layout/Et2Tabs/Et2TabsMobile.ts @@ -14,7 +14,6 @@ export class Et2TabsMobile extends Et2Tabs connectedCallback() { super.connectedCallback(); - this.nav = this.shadowRoot.querySelector("et2-vbox"); } protected createTabs(tabData) @@ -53,6 +52,47 @@ export class Et2TabsMobile extends Et2Tabs // Don't have an indicator to sync } + repositionIndicator() + { + // Don't have an indicator to reposition + } + + preventIndicatorTransition() + { + // Don't have an indicator + } + + /** + * Reimplement to allow our existing function signatures too + * + * @deprecated use this.show(name : string) + * @param tab number or name of tab (Sl uses that internally with a SlTab!) + * @param options + */ + setActiveTab(tab : SlTab | String | Number, options? : { + emitEvents? : boolean; + scrollBehavior? : 'auto' | 'smooth'; + }) + { + if(typeof tab === 'number') + { + tab = this.getAllTabs()[tab]; + return this.show(tab.panel); + } + if(typeof tab === 'string') + { + return this.show(tab); + } + // Don't call super, it hides tab content + } + + + get nav() : HTMLElement + { + return this.shadowRoot.querySelector("et2-vbox"); + } + + protected tabTemplate(tab, index : number) : TemplateResult { return html`