Skip to content

Commit

Permalink
Fixed #10837 - TabView: p-tabview-ink-bar doesn't follow the size of …
Browse files Browse the repository at this point in the history
…TabPanel header property change
  • Loading branch information
yigitfindikli committed Dec 8, 2021
1 parent 5ca9791 commit 46be1a0
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/app/components/tabview/tabview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ export class TabPanel implements AfterContentInit,OnDestroy {

set header(header: string) {
this._header = header;
this.tabView.updateInkBar();
this.tabView.cd.markForCheck();
}

Expand Down Expand Up @@ -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) {
Expand Down

1 comment on commit 46be1a0

@magicdict
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change will make tab-panel wtth ngIf condition raise a exception.(the tabHeader is null);

Please sign in to comment.