Skip to content

Commit 52c0977

Browse files
Fix Create a new process page accessibility issues
- Added missing aria-label to delete buttons - Moved hardcoded translation to translation files - Fix color contrast issues on buttons - Fix minor alignment issues - Added missing aria labels to input and select elements
1 parent 4ea487c commit 52c0977

11 files changed

Lines changed: 44 additions & 16 deletions

File tree

src/app/process-page/form/process-form.component.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
<h2 class="col-12">
44
{{headerKey | translate}}
55
</h2>
6-
<div class="col-12 col-md-6">
6+
<div class="col-12 col-md-6 mb-2">
77
<form #form="ngForm" (ngSubmit)="submitForm(form)">
88
<ds-scripts-select [script]="selectedScript" (select)="selectedScript = $event; parameters = undefined"></ds-scripts-select>
99
<ds-process-parameters [initialParams]="parameters" [script]="selectedScript" (updateParameters)="parameters = $event"></ds-process-parameters>
10-
<button [routerLink]="['/processes']" class="btn btn-light float-left">{{ 'process.new.cancel' | translate }}</button>
11-
<button type="submit" class="btn btn-light float-right">{{ 'process.new.submit' | translate }}</button>
10+
<a [routerLink]="['/processes']" class="btn btn-danger float-left">{{ 'process.new.cancel' | translate }}</a>
11+
<button type="submit" class="btn btn-primary float-right">{{ 'process.new.submit' | translate }}</button>
1212
</form>
1313
</div>
1414
<div class="col-12 col-md-6">
Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
1-
<div class="form-row mb-2 mx-0">
1+
<div class="form-row gap-2 mb-2 mx-0">
22
<select id="process-parameters"
33
class="form-control col"
44
name="parameter-{{index}}"
5+
[attr.aria-label]="'process.new.select-parameter' | translate"
56
[(ngModel)]="selectedParameter"
67
#param="ngModel">
7-
<option [ngValue]="undefined">Add a parameter...</option>
8+
<option [ngValue]="undefined">{{ 'process.new.add-parameter' | translate }}</option>
89
<option *ngFor="let param of parameters" [ngValue]="param.name">
910
{{param.nameLong || param.name}}
1011
</option>
1112
</select>
12-
<ds-parameter-value-input [initialValue]="parameterValue.value" [parameter]="selectedScriptParameter" (updateValue)="selectedParameterValue = $event" class="d-block col" [index]="index"></ds-parameter-value-input>
13-
<button *ngIf="removable" class="btn btn-light col-1 remove-button" (click)="removeParameter.emit(parameterValue);"><span class="fas fa-trash"></span></button>
13+
<ds-parameter-value-input [initialValue]="parameterValue.value" [parameter]="selectedScriptParameter" (updateValue)="selectedParameterValue = $event" class="d-block col px-0" [index]="index"></ds-parameter-value-input>
14+
<button *ngIf="removable" [attr.aria-label]="'process.new.delete-parameter' | translate"
15+
(click)="removeParameter.emit(parameterValue);" class="btn btn-danger col-1 remove-button">
16+
<i class="fas fa-trash"></i>
17+
</button>
1418
<span *ngIf="!removable" class="col-1"></span>
1519
</div>
1620

src/app/process-page/form/process-parameters/parameter-select/parameter-select.component.spec.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
2-
2+
import { TranslateModule } from '@ngx-translate/core';
33
import { ParameterSelectComponent } from './parameter-select.component';
44
import { NO_ERRORS_SCHEMA } from '@angular/core';
55
import { FormsModule } from '@angular/forms';
@@ -33,7 +33,10 @@ describe('ParameterSelectComponent', () => {
3333
beforeEach(waitForAsync(() => {
3434
init();
3535
TestBed.configureTestingModule({
36-
imports: [FormsModule],
36+
imports: [
37+
FormsModule,
38+
TranslateModule.forRoot(),
39+
],
3740
declarations: [ParameterSelectComponent],
3841
schemas: [NO_ERRORS_SCHEMA]
3942
})
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<input type="hidden" value="true" name="boolean-value-{{index}}" id="boolean-value-{{index}}"/>
1+
<input [attr.aria-label]="'process.new.parameter.label' | translate" type="hidden" value="true" name="boolean-value-{{index}}" id="boolean-value-{{index}}"/>

src/app/process-page/form/process-parameters/parameter-value-input/boolean-value-input/boolean-value-input.component.spec.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
2-
2+
import { TranslateModule } from '@ngx-translate/core';
33
import { BooleanValueInputComponent } from './boolean-value-input.component';
44

55
describe('BooleanValueInputComponent', () => {
@@ -8,6 +8,9 @@ describe('BooleanValueInputComponent', () => {
88

99
beforeEach(waitForAsync(() => {
1010
TestBed.configureTestingModule({
11+
imports: [
12+
TranslateModule.forRoot(),
13+
],
1114
declarations: [BooleanValueInputComponent]
1215
})
1316
.compileComponents();

src/app/process-page/form/process-parameters/parameter-value-input/date-value-input/date-value-input.component.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
<input required #string="ngModel" type="text" class="form-control" name="date-value-{{index}}" id="date-value-{{index}}" [ngModel]="value" (ngModelChange)="setValue($event)"/>
1+
<input [attr.aria-label]="'process.new.parameter.label' | translate" required #string="ngModel" type="text" class="form-control" name="date-value-{{index}}" id="date-value-{{index}}" [ngModel]="value" (ngModelChange)="setValue($event)"/>
22
<div *ngIf="string.invalid && (string.dirty || string.touched)"
3-
class="alert alert-danger validation-error">
3+
class="alert alert-danger validation-error mb-0">
44
<div *ngIf="string.errors.required">
55
{{'process.new.parameter.string.required' | translate}}
66
</div>
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
:host {
2+
display: flex;
3+
flex-direction: column;
4+
gap: calc(var(--bs-spacer) / 2);
5+
}

src/app/process-page/form/process-parameters/parameter-value-input/file-value-input/file-value-input.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<label for="file-upload-{{index}}" class="d-flex align-items-center m-0">
2-
<span class="btn btn-light">
2+
<span class="btn btn-primary">
33
{{'process.new.parameter.file.upload-button' | translate}}
44
</span>
55
<span class="file-name ml-1">{{fileObject?.name}}</span>

src/app/process-page/form/process-parameters/parameter-value-input/string-value-input/string-value-input.component.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
<input required #string="ngModel" type="text" name="string-value-{{index}}" class="form-control" id="string-value-{{index}}" [ngModel]="value" (ngModelChange)="setValue($event)"/>
1+
<input [attr.aria-label]="'process.new.parameter.label' | translate" required #string="ngModel" type="text" name="string-value-{{index}}" class="form-control" id="string-value-{{index}}" [ngModel]="value" (ngModelChange)="setValue($event)"/>
22
<div *ngIf="string.invalid && (string.dirty || string.touched)"
3-
class="alert alert-danger validation-error">
3+
class="alert alert-danger validation-error mb-0">
44
<div *ngIf="string.errors.required">
55
{{'process.new.parameter.string.required' | translate}}
66
</div>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
:host {
2+
display: flex;
3+
flex-direction: column;
4+
gap: calc(var(--bs-spacer) / 2);
5+
}

0 commit comments

Comments
 (0)