Skip to content

Commit

Permalink
fix(dialog): focus dialog on open #3199
Browse files Browse the repository at this point in the history
  • Loading branch information
Tacho committed Dec 3, 2018
1 parent 5e1b432 commit b01b7b2
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions projects/igniteui-angular/src/lib/dialog/dialog.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -372,13 +372,18 @@ export class IgxDialogComponent implements IToggleView, OnInit, OnDestroy, After
}

ngAfterContentInit() {
this.onOpen.pipe(takeUntil(this.destroy$)).subscribe(() => this.focusDialog());
this.toggleRef.onClosing.pipe(takeUntil(this.destroy$)).subscribe(() => this.emitCloseFromDialog());
}

private emitCloseFromDialog() {
this.onClose.emit({ dialog: this, event: null });
}

private focusDialog() {
this.toggleRef.element.focus();
}

/**
* A method that opens the dialog.
* @memberOf {@link IgxDialogComponent}
Expand Down

0 comments on commit b01b7b2

Please sign in to comment.