Skip to content

Commit

Permalink
fix(drawer): not restoring focus on close (#7668)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
crisbeto authored and andrewseguin committed Oct 12, 2017
1 parent 9b3ffd5 commit 3041124
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/lib/sidenav/drawer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 3041124

Please sign in to comment.