Skip to content

Commit 07a16de

Browse files
matskommalerba
authored andcommitted
chore: fix inherited host binding issue with sidenav (#15895)
Due to the inheritance changes present in the Ivy refactor, animation host bindings are being inherited into a the SideNav sub component unexpectedly. This patch ensures that SideNav uses the same animation binding as does its super class.
1 parent b84a8a6 commit 07a16de

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/material/sidenav/drawer.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ import {
3636
ViewChild,
3737
ViewEncapsulation,
3838
HostListener,
39+
HostBinding,
3940
} from '@angular/core';
4041
import {fromEvent, merge, Observable, Subject} from 'rxjs';
4142
import {
@@ -116,7 +117,6 @@ export class MatDrawerContent extends CdkScrollable implements AfterContentInit
116117
animations: [matDrawerAnimations.transformDrawer],
117118
host: {
118119
'class': 'mat-drawer',
119-
'[@transform]': '_animationState',
120120
// must prevent the browser from aligning text based on value
121121
'[attr.align]': 'null',
122122
'[class.mat-drawer-end]': 'position === "end"',
@@ -179,6 +179,11 @@ export class MatDrawer implements AfterContentInit, AfterContentChecked, OnDestr
179179
_animationEnd = new Subject<AnimationEvent>();
180180

181181
/** Current state of the sidenav animation. */
182+
// @HostBinding is used in the class as it is expected to be extended. Since @Component decorator
183+
// metadata is not inherited by child classes, instead the host binding data is defined in a way
184+
// that can be inherited.
185+
// tslint:disable:no-host-decorator-in-concrete
186+
@HostBinding('@transform')
182187
_animationState: 'open-instant' | 'open' | 'void' = 'void';
183188

184189
/** Event emitted when the drawer open state is changed. */

src/material/sidenav/sidenav.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ export class MatSidenavContent extends MatDrawerContent {
5959
host: {
6060
'class': 'mat-drawer mat-sidenav',
6161
'tabIndex': '-1',
62-
'[@transform]': '_animationState',
6362
// must prevent the browser from aligning text based on value
6463
'[attr.align]': 'null',
6564
'[class.mat-drawer-end]': 'position === "end"',

0 commit comments

Comments
 (0)