Skip to content
This repository has been archived by the owner on Mar 27, 2023. It is now read-only.

Commit

Permalink
[NG] Add focus method guard to FocusTrap
Browse files Browse the repository at this point in the history
- Addresses use cases for IE11 where the previousActiveELement may not have the focus method
- Closes #1587

Signed-off-by: Matt Hippely <mhippely@vmware.com>
  • Loading branch information
hippee-lee committed Oct 16, 2017
1 parent 75f6d94 commit 3e4db88
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/clarity-angular/utils/focus-trap/focus-trap.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ export class FocusTrapDirective implements AfterViewInit, OnDestroy {
}

public setPreviousFocus(): void {
this._previousActiveElement.focus();
if (this._previousActiveElement && this._previousActiveElement.focus) {
this._previousActiveElement.focus();
}
}

ngOnDestroy() {
Expand Down

0 comments on commit 3e4db88

Please sign in to comment.