Skip to content

Commit

Permalink
fix(bal-tabs): call move line function when accordion with tabs in it…
Browse files Browse the repository at this point in the history
… opens
  • Loading branch information
mladenplaninicic committed Nov 2, 2022
1 parent 0135f11 commit c79b71e
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions packages/components/src/components/bal-tabs/bal-tabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export class Tabs {
private didInit = false
private mutationO?: MutationObserver
private timeoutTimer?: NodeJS.Timer
private accordion: HTMLBalAccordionElement | null = null

@State() tabsOptions: BalTabOption[] = []
@State() lineWidth = 0
Expand Down Expand Up @@ -136,6 +137,14 @@ export class Tabs {
this.debounceChanged()
this.updateTabs()

const accordion = (this.accordion = this.el.closest('bal-accordion'))

if (accordion) {
accordion.addEventListener('balChange', () => {
this.moveLine(this.getTargetElement(this.value))
})
}

this.mutationO = watchForTabs<HTMLBalTabItemElement>(this.el, 'bal-tab-item', () => {
this.updateTabs()
})
Expand Down

0 comments on commit c79b71e

Please sign in to comment.