Skip to content

Commit

Permalink
fix(material/sidenav): mark sidenav content as scrollable (#19848)
Browse files Browse the repository at this point in the history
Marks the sidenav's inner scrollable element as `cdkScrollable` so any overlays placed
inside of it can update.

Fixes #19846.
Fixes #18453.

(cherry picked from commit 2fa78c6)
  • Loading branch information
crisbeto authored and annieyw committed Apr 6, 2021
1 parent f387ff6 commit 3ee9bcf
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/material/sidenav/drawer.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<div class="mat-drawer-inner-container">
<div class="mat-drawer-inner-container" cdkScrollable>
<ng-content></ng-content>
</div>
11 changes: 11 additions & 0 deletions src/material/sidenav/drawer.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -642,6 +642,17 @@ describe('MatDrawer', () => {
}));

});

it('should mark the drawer content as scrollable', () => {
const fixture = TestBed.createComponent(BasicTestApp);
fixture.detectChanges();

const content = fixture.debugElement.query(By.css('.mat-drawer-inner-container'));
const scrollable = content.injector.get(CdkScrollable);
expect(scrollable).toBeTruthy();
expect(scrollable.getElementRef().nativeElement).toBe(content.nativeElement);
});

});

describe('MatDrawerContainer', () => {
Expand Down

0 comments on commit 3ee9bcf

Please sign in to comment.