Skip to content

Commit

Permalink
Merge pull request #11591 from volvachev/fix-tabmenu-forward-btn
Browse files Browse the repository at this point in the history
fix(primeng/p-tabmenu): show the `forward` button when necessary
  • Loading branch information
cetincakiroglu authored Jun 7, 2022
2 parents 61ca809 + b5c5cd0 commit 4a12482
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/app/components/tabmenu/tabmenu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,10 @@ export class TabMenu implements AfterContentInit,AfterViewInit,AfterViewChecked,
});
}

ngAfterViewInit() {
ngAfterViewInit(): void {
this.updateInkBar();
this.initAutoScrollForActiveItem();
this.initButtonState();
}

ngAfterViewChecked() {
Expand Down Expand Up @@ -229,6 +230,17 @@ export class TabMenu implements AfterContentInit,AfterViewInit,AfterViewChecked,
this.timerIdForInitialAutoScroll = null;
}
}

private initButtonState(): void {
if (this.scrollable) {
// We have to wait for the rendering and then retrieve the actual size element from the DOM.
// in future `Promise.resolve` can be changed to `queueMicrotask` (if ie11 support will be dropped)
Promise.resolve().then(() => {
this.updateButtonState();
this.cd.markForCheck();
});
}
}
}

@NgModule({
Expand Down

0 comments on commit 4a12482

Please sign in to comment.