From 46be1a03978ea2e7cbd3a6b1e92a5f9990a25b03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yi=C4=9Fit=20FINDIKLI?= Date: Wed, 8 Dec 2021 16:57:40 +0300 Subject: [PATCH] Fixed #10837 - TabView: p-tabview-ink-bar doesn't follow the size of TabPanel header property change --- src/app/components/tabview/tabview.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/app/components/tabview/tabview.ts b/src/app/components/tabview/tabview.ts index 87eaff90679..3fcb62c7c55 100755 --- a/src/app/components/tabview/tabview.ts +++ b/src/app/components/tabview/tabview.ts @@ -120,6 +120,7 @@ export class TabPanel implements AfterContentInit,OnDestroy { set header(header: string) { this._header = header; + this.tabView.updateInkBar(); this.tabView.cd.markForCheck(); } @@ -380,9 +381,11 @@ export class TabView implements AfterContentInit,AfterViewChecked,BlockableUI { } updateInkBar() { - let tabHeader = DomHandler.findSingle(this.navbar.nativeElement, 'li.p-highlight'); - this.inkbar.nativeElement.style.width = DomHandler.getWidth(tabHeader) + 'px'; - this.inkbar.nativeElement.style.left = DomHandler.getOffset(tabHeader).left - DomHandler.getOffset(this.navbar.nativeElement).left + 'px'; + if (this.navbar) { + let tabHeader = DomHandler.findSingle(this.navbar.nativeElement, 'li.p-highlight'); + this.inkbar.nativeElement.style.width = DomHandler.getWidth(tabHeader) + 'px'; + this.inkbar.nativeElement.style.left = DomHandler.getOffset(tabHeader).left - DomHandler.getOffset(this.navbar.nativeElement).left + 'px'; + } } updateScrollBar(index) {