From 3041124a02f70d732f6d2a8e4b32d5b9fdb3c2c4 Mon Sep 17 00:00:00 2001 From: Kristiyan Kostadinov Date: Thu, 12 Oct 2017 07:20:13 +0200 Subject: [PATCH] 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. --- src/lib/sidenav/drawer.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/lib/sidenav/drawer.ts b/src/lib/sidenav/drawer.ts index 9fd9a2b449a7..51193b112e3a 100644 --- a/src/lib/sidenav/drawer.ts +++ b/src/lib/sidenav/drawer.ts @@ -307,6 +307,7 @@ export class MatDrawer implements AfterContentInit, OnDestroy { this._animationState = this._enableAnimations ? 'open' : 'open-instant'; } else { this._animationState = 'void'; + this._restoreFocus(); } if (this._focusTrap) {