Skip to content

Commit

Permalink
fix(primeng/p-tabmenu): show the `forward' button when necessary
Browse files Browse the repository at this point in the history
Fixes #11415.
  • Loading branch information
volvachev authored and Egor Volvachev committed Jun 7, 2022
1 parent 61ca809 commit b5c5cd0
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 b5c5cd0

Please sign in to comment.