Skip to content

Commit a99d2e3

Browse files
committed
Merge branch 'main' into 303-updates
2 parents 26cd932 + d2ed432 commit a99d2e3

2 files changed

Lines changed: 175 additions & 11 deletions

File tree

package-lock.json

Lines changed: 162 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/tabs.ts

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -238,11 +238,20 @@ export function tabWidget (options: TabWidgetOptions) {
238238
)
239239

240240
const tab = selectedTab1 || selectedTab0 || (tabContainer.children[0] as HTMLButtonElement)
241-
const clickMe = tab.firstChild
242-
// @ts-ignore
243-
if (clickMe) clickMe.click()
241+
const clickMe = tab.firstChild as HTMLElement | null
242+
if (clickMe?.click) {
243+
clickMe.click()
244+
} else if (tab instanceof HTMLElement) {
245+
tab.click()
246+
}
244247
} else if (!options.startEmpty) {
245-
(tabContainer.children[0].firstChild as HTMLButtonElement).click() // Open first tab
248+
const firstTab = tabContainer.children[0]
249+
const clickTarget = firstTab?.firstChild as HTMLElement | null
250+
if (clickTarget?.click) {
251+
clickTarget.click()
252+
} else if (firstTab instanceof HTMLElement) {
253+
firstTab.click() // Open first tab
254+
}
246255
}
247256
return rootElement
248257

0 commit comments

Comments
 (0)