Skip to content

Commit 3041124

Browse files
crisbetoandrewseguin
authored andcommitted
fix(drawer): not restoring focus on close (#7668)
Currently the drawer restores focus on close after its closing animation is done and it contains the currently-focused element. This will always evaluate to false, because the sidenav gets a `visibility: hidden` which will blur any focused elements that it may have. With these changes the drawer will restore focus when the animation starts and it's still visible.
1 parent 9b3ffd5 commit 3041124

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/lib/sidenav/drawer.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,7 @@ export class MatDrawer implements AfterContentInit, OnDestroy {
307307
this._animationState = this._enableAnimations ? 'open' : 'open-instant';
308308
} else {
309309
this._animationState = 'void';
310+
this._restoreFocus();
310311
}
311312

312313
if (this._focusTrap) {

0 commit comments

Comments
 (0)