Skip to content

Commit

Permalink
Merge pull request #99 from github/early_return_if_undefined_tab
Browse files Browse the repository at this point in the history
Return early if tab or panel are undefined
  • Loading branch information
camertron authored Jun 20, 2024
2 parents 98f5d77 + 13de837 commit e0a9011
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/tab-container-element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,9 @@ export class TabContainerElement extends HTMLElement {
const selectedTab = tabs[index]
const selectedPanel = panels[index]

if (!selectedTab) return
if (!selectedPanel) return

if (this.#setupComplete) {
const cancelled = !this.dispatchEvent(
new TabContainerChangeEvent('tab-container-change', {
Expand Down

0 comments on commit e0a9011

Please sign in to comment.