Skip to content

Commit 68dd890

Browse files
[DURACOM-347] remove property, disable placeholder on date field and concat/series (replace with labels)
1 parent ac69e2f commit 68dd890

8 files changed

Lines changed: 7 additions & 24 deletions

File tree

config/config.example.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -237,11 +237,6 @@ submission:
237237
- value: default
238238
style: text-muted
239239
icon: fa-circle-xmark
240-
# If set to true avoid setting placeholder for simple fields, where the placeholder would be the same as the label.
241-
# The default is set to true as placeholders that do not provide additional information to the field are to be avoided as they could cause accessibility issue.
242-
# More info on the topic can be found at https://www.deque.com/blog/accessible-forms-the-problem-with-placeholders/
243-
omitSimpleFieldPlaceholders:
244-
245240

246241
# Fallback language in which the UI will be rendered if the user's browser language is not an active language
247242
fallbackLanguage: en

src/app/shared/form/builder/parsers/concat-field-parser.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,18 +92,18 @@ export class ConcatFieldParser extends FieldParser {
9292
concatGroup.disabled = input1ModelConfig.readOnly;
9393

9494
if (isNotEmpty(this.firstPlaceholder)) {
95-
input1ModelConfig.placeholder = this.firstPlaceholder;
95+
input1ModelConfig.label = this.firstPlaceholder;
9696
}
9797

9898
if (isNotEmpty(this.secondPlaceholder)) {
99-
input2ModelConfig.placeholder = this.secondPlaceholder;
99+
input2ModelConfig.label = this.secondPlaceholder;
100100
}
101101

102102
// Split placeholder if is like 'placeholder1/placeholder2'
103103
const placeholder = this.configData.label.split('/');
104104
if (placeholder.length === 2) {
105-
input1ModelConfig.placeholder = placeholder[0];
106-
input2ModelConfig.placeholder = placeholder[1];
105+
input1ModelConfig.label = placeholder[0];
106+
input2ModelConfig.label = placeholder[1];
107107
}
108108

109109
const model1 = new DsDynamicInputModel(input1ModelConfig, clsInput);

src/app/shared/form/builder/parsers/date-field-parser.spec.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,8 @@ describe('DateFieldParser test suite', () => {
6868
expect(fieldModel.value).toEqual(expectedValue);
6969
});
7070

71-
it('should skip setting the placeholder when ignore omitSimpleFieldPlaceholders is true', () => {
71+
it('should skip setting the placeholder', () => {
7272
const parser = new DateFieldParser(submissionId, field, initFormValues, parserOptions, translateService);
73-
parser.omitSimpleFieldPlaceholders = true;
7473
const fieldModel = parser.parse();
7574

7675
expect(fieldModel.placeholder).toBeNull();

src/app/shared/form/builder/parsers/field-parser.ts

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import {
1919
import { DynamicFormControlLayout } from '@ng-dynamic-forms/core';
2020
import { TranslateService } from '@ngx-translate/core';
2121
import uniqueId from 'lodash/uniqueId';
22-
import { environment } from 'src/environments/environment';
2322

2423
import {
2524
DsDynamicInputModel,
@@ -54,16 +53,13 @@ export abstract class FieldParser {
5453
*/
5554
protected typeField: string;
5655

57-
omitSimpleFieldPlaceholders: boolean;
58-
5956
constructor(
6057
@Inject(SUBMISSION_ID) protected submissionId: string,
6158
@Inject(CONFIG_DATA) protected configData: FormFieldModel,
6259
@Inject(INIT_FORM_VALUES) protected initFormValues: any,
6360
@Inject(PARSER_OPTIONS) protected parserOptions: ParserOptions,
6461
protected translate: TranslateService,
6562
) {
66-
this.omitSimpleFieldPlaceholders = environment.submission.omitSimpleFieldPlaceholders;
6763
}
6864

6965
public abstract modelFactory(fieldValue?: FormFieldMetadataValueObject, label?: boolean): any;
@@ -310,11 +306,8 @@ export abstract class FieldParser {
310306
if (hint) {
311307
controlModel.hint = this.configData.hints || ' ';
312308
}
313-
if (!this.omitSimpleFieldPlaceholders) {
314-
controlModel.placeholder = this.configData.label;
315-
} else {
316-
controlModel.additional = { ...controlModel.additional, ariaLabel: this.configData.label };
317-
}
309+
310+
controlModel.additional = { ...controlModel.additional, ariaLabel: this.configData.label };
318311

319312
if (this.configData.mandatory && setErrors) {
320313
this.markAsRequired(controlModel);

src/app/shared/form/number-picker/number-picker.component.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
[readonly]="disabled"
2727
[disabled]="disabled"
2828
[ngClass]="{'is-invalid': invalid}"
29-
placeholder="{{'form.number-picker.label.' + placeholder | translate }}"
3029
title="{{'form.number-picker.label.' + placeholder | translate}}"
3130
[attr.aria-labelledby]="id + ' increment-' + id + ' decrement-' + id"
3231
>

src/config/default-app-config.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,6 @@ export class DefaultAppConfig implements AppConfig {
254254
],
255255
},
256256
},
257-
omitSimpleFieldPlaceholders: true,
258257
};
259258

260259
// Fallback language in which the UI will be rendered if the user's browser language is not an active language

src/config/submission-config.interface.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,4 @@ export interface SubmissionConfig extends Config {
3636
duplicateDetection: DuplicateDetectionConfig;
3737
typeBind: TypeBindConfig;
3838
icons: IconsConfig;
39-
omitSimpleFieldPlaceholders?: boolean;
4039
}

src/environments/environment.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,6 @@ export const environment: BuildConfig = {
195195
],
196196
},
197197
},
198-
omitSimpleFieldPlaceholders: false,
199198
},
200199

201200
// NOTE: will log all redux actions and transfers in console

0 commit comments

Comments
 (0)