diff --git a/src/demo-app/tabs/tabs-demo.html b/src/demo-app/tabs/tabs-demo.html index 8b85ef763f3d..ea8d13b554a2 100644 --- a/src/demo-app/tabs/tabs-demo.html +++ b/src/demo-app/tabs/tabs-demo.html @@ -288,3 +288,41 @@

Tabs with autosize textarea

+ +

Tabs with expansion panel

+ + + + Tab 1 + + + + + + Expanded + + + This content is expanded. + + + + + + + + + Tab 2 + + + + + + Collapsed + + + This content is collapsed. + + + + + \ No newline at end of file diff --git a/src/lib/tabs/tab-body.ts b/src/lib/tabs/tab-body.ts index 81a075c71292..674c2b64547e 100644 --- a/src/lib/tabs/tab-body.ts +++ b/src/lib/tabs/tab-body.ts @@ -76,7 +76,7 @@ export class MatTabBodyPortal extends CdkPortalOutlet implements OnInit, OnDestr /** Set initial visibility or set up subscription for changing visibility. */ ngOnInit(): void { - if (this._host._isCenterPosition(this._host._position)) { + if (!this.hasAttached()) { this.attach(this._host._content); } this._centeringSub = this._host._beforeCentering.subscribe((isCentering: boolean) => {