Skip to content

fix(sidenav): implicit content element being registered twice with scroll dispatcher #13973

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/material/sidenav/drawer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,10 @@ export function MAT_DRAWER_DEFAULT_AUTOSIZE_FACTORY(): boolean {
},
changeDetection: ChangeDetectionStrategy.OnPush,
encapsulation: ViewEncapsulation.None,
providers: [{
provide: CdkScrollable,
useExisting: MatDrawerContent,
}]
})
export class MatDrawerContent extends CdkScrollable implements AfterContentInit {
constructor(
Expand Down
2 changes: 1 addition & 1 deletion src/material/sidenav/sidenav-container.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@

<ng-content select="mat-sidenav-content">
</ng-content>
<mat-sidenav-content *ngIf="!_content" cdkScrollable>
<mat-sidenav-content *ngIf="!_content">
<ng-content></ng-content>
</mat-sidenav-content>
6 changes: 5 additions & 1 deletion src/material/sidenav/sidenav.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import {
coerceNumberProperty,
NumberInput
} from '@angular/cdk/coercion';
import {ScrollDispatcher} from '@angular/cdk/scrolling';
import {ScrollDispatcher, CdkScrollable} from '@angular/cdk/scrolling';


@Component({
Expand All @@ -41,6 +41,10 @@ import {ScrollDispatcher} from '@angular/cdk/scrolling';
},
changeDetection: ChangeDetectionStrategy.OnPush,
encapsulation: ViewEncapsulation.None,
providers: [{
provide: CdkScrollable,
useExisting: MatSidenavContent,
}]
})
export class MatSidenavContent extends MatDrawerContent {
constructor(
Expand Down