Skip to content

Commit 36c627b

Browse files
authored
fix(material/sidenav): not closing on escape key press (angular#29292)
Fixes that the sidenav wasn't triggering change detection when closing via a escape key press.
1 parent d1e59f6 commit 36c627b

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/material/sidenav/drawer.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,7 @@ export class MatDrawer implements AfterViewInit, AfterContentChecked, OnDestroy
322322
readonly _modeChanged = new Subject<void>();
323323

324324
private _injector = inject(Injector);
325+
private _changeDetectorRef = inject(ChangeDetectorRef);
325326

326327
constructor(
327328
private _elementRef: ElementRef<HTMLElement>,
@@ -593,6 +594,8 @@ export class MatDrawer implements AfterViewInit, AfterContentChecked, OnDestroy
593594
}
594595
}
595596

597+
// Needed to ensure that the closing sequence fires off correctly.
598+
this._changeDetectorRef.markForCheck();
596599
this._updateFocusTrapState();
597600

598601
return new Promise<MatDrawerToggleResult>(resolve => {

0 commit comments

Comments
 (0)