Skip to content
This repository has been archived by the owner on Nov 21, 2024. It is now read-only.

Commit

Permalink
fix(contentModal): Remove default focus from button
Browse files Browse the repository at this point in the history
  • Loading branch information
EndyKaufman committed May 14, 2017
1 parent 144d722 commit a619f48
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ export class AppComponent extends BaseComponent {
title = this.translateService.instant('Info');
}
const alert: AlertModalComponent = this.app.modals(this.resolver).create(AlertModalComponent);
alert.focused = false;
alert.name = 'error';
alert.text = title;
alert.content = content;
Expand Down
6 changes: 5 additions & 1 deletion src/base/base-modal/base-modal.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import * as _ from 'lodash';

export class BaseModalComponent extends BaseComponent {

@Input()
focused = true;
@Input()
class = '';
@Input()
Expand Down Expand Up @@ -32,7 +34,9 @@ export class BaseModalComponent extends BaseComponent {
});
this.modal.onShown.subscribe(() => {
// todo: fix history.pushState(null, null, this.currentLocation + '/' + _.kebabCase(this.name));
this.focus();
if (this.focused) {
this.focus();
}
this.afterOpen();
});
if (this.message.length > 100) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ export class AccountProfileFormComponent extends BaseComponent {
onSave: EventEmitter<AccountProfileFormComponent | any> = new EventEmitter();

init() {
this.focus();
this.userGroups.user = this.item;
this.userGroups.mockedItems =
this.item.groups.map((group: any | Group) => {
Expand Down
1 change: 0 additions & 1 deletion src/grids/users-grid/user-modal/user-modal.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ export class UserModalComponent extends BaseResourceModalComponent {
onSave: EventEmitter<UserModalComponent | any> = new EventEmitter();

afterOpen() {
this.focus();
this.userGroups.user = this.item;
this.userGroups.mockedItems =
this.item.groups.map((group: any | Group) => {
Expand Down

0 comments on commit a619f48

Please # to comment.