Force focus on click, even in accesibility mode

pull/4381/head
Oliver Günther 9 years ago
parent aca68c92b6
commit 0039d7727f
  1. 21
      frontend/app/components/wp-edit/wp-edit-field/wp-edit-field.directive.ts
  2. 6
      frontend/app/components/wp-table/wp-row/wp-row.directive.js

@ -41,6 +41,7 @@ export class WorkPackageEditFieldController {
protected pristineValue:any;
protected _active:boolean = false;
protected _forceFocus:boolean = false;
// Since we load the schema asynchronously
// all fields are initially viewed as editable until it is loaded
@ -48,7 +49,10 @@ export class WorkPackageEditFieldController {
constructor(
protected wpEditField:WorkPackageEditFieldService,
protected $scope,
protected $element,
protected $timeout,
protected FocusHelper,
protected NotificationsService,
protected I18n) {
@ -67,9 +71,9 @@ export class WorkPackageEditFieldController {
.then(() => this.deactivate());
}
public activate(forceFocus = true) {
public activate() {
if (this._active) {
this.setFocus(forceFocus);
this.focusField();
return;
}
@ -86,7 +90,7 @@ export class WorkPackageEditFieldController {
));
}
this.setFocus(forceFocus);
this.focusField();
});
}
@ -120,16 +124,17 @@ export class WorkPackageEditFieldController {
}
public shouldFocus() {
return !this.workPackage.isNew || this.formCtrl.firstActiveField === this.fieldName;
return this._forceFocus ||
!this.workPackage.isNew ||
this.formCtrl.firstActiveField === this.fieldName;
}
public setFocus(focus = true) {
if (focus) {
this.$element.find('.wp-inline-edit--field').focus();
}
public focusField() {
this.$timeout(_ => this.$scope.$broadcast('updateFocus'));
}
public deactivate():boolean {
this._forceFocus = false;
return this._active = false;
}

@ -49,12 +49,6 @@ function wpRow(WorkPackagesTableService){
scope.workPackage = scope.row.object;
setCheckboxTitle(scope);
scope.$watch('row.object.schema.$loaded', function(isLoaded) {
if (!isLoaded) {
scope.row.object.schema.$load();
}
});
if (scope.row.parent) setHiddenWorkPackageLabel(scope);
scope.$watch('row.checked', function(checked, formerState) {

Loading…
Cancel
Save