[ACS-10283] a11y fix - Folder rules 'when' label is not associated with checkboxes (#4968)

* [ACS-10283] a11y fix - Folder rules 'when' label is not associated with checkboxes

* [ACS-10283] fix sonar issue

* [ACS-10283] fix also for other options
This commit is contained in:
Mykyta Maliarchuk
2026-01-09 10:38:55 +01:00
committed by GitHub
parent 90f6fedd11
commit 21963b9363
7 changed files with 44 additions and 26 deletions
@@ -1,4 +1,4 @@
<ng-container [formGroup]="form"> <fieldset [formGroup]="form" [attr.aria-labelledby]="ariaLabelledBy">
<div class="aca-rule-options__option" *ngIf="!readOnly || isAsynchronousChecked"> <div class="aca-rule-options__option" *ngIf="!readOnly || isAsynchronousChecked">
<mat-checkbox <mat-checkbox
formControlName="isAsynchronous" formControlName="isAsynchronous"
@@ -26,7 +26,6 @@
{{ option.label }} {{ option.label }}
</mat-option> </mat-option>
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
</div> </div>
@@ -48,4 +47,4 @@
{{ 'ACA_FOLDER_RULES.RULE_DETAILS.OPTIONS.DISABLE_RULE' | translate }} {{ 'ACA_FOLDER_RULES.RULE_DETAILS.OPTIONS.DISABLE_RULE' | translate }}
</mat-checkbox> </mat-checkbox>
</div> </div>
</ng-container> </fieldset>
@@ -1,7 +1,12 @@
.aca-rule-options { .aca-rule-options {
fieldset {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
gap: 24px; gap: 24px;
border: none;
padding: 0;
margin: 0;
}
&__option { &__option {
display: flex; display: flex;
@@ -70,6 +70,8 @@ export class RuleOptionsUiComponent implements ControlValueAccessor, OnChanges,
hideErrorScriptDropdown = true; hideErrorScriptDropdown = true;
@Input() ariaLabelledBy = 'rule-options-label';
@Input() @Input()
errorScriptConstraint: ActionParameterConstraint; errorScriptConstraint: ActionParameterConstraint;
@@ -30,7 +30,7 @@
</ng-container> </ng-container>
<div class="aca-rule-details__form__row aca-rule-details__form__triggers"> <div class="aca-rule-details__form__row aca-rule-details__form__triggers">
<div class="aca-label">{{ 'ACA_FOLDER_RULES.RULE_DETAILS.LABEL.WHEN' | translate }}</div> <span id="rule-triggers-label" class="aca-label">{{ 'ACA_FOLDER_RULES.RULE_DETAILS.LABEL.WHEN' | translate }}</span>
<div> <div>
<aca-rule-triggers formControlName="triggers" data-automation-id="rule-details-triggers-component" /> <aca-rule-triggers formControlName="triggers" data-automation-id="rule-details-triggers-component" />
<mat-error class="aca-rule-details-error" *ngIf="triggers.hasError('required')">{{ 'ACA_FOLDER_RULES.RULE_DETAILS.ERROR.INSUFFICIENT_TRIGGERS_SELECTED' | translate }}</mat-error> <mat-error class="aca-rule-details-error" *ngIf="triggers.hasError('required')">{{ 'ACA_FOLDER_RULES.RULE_DETAILS.ERROR.INSUFFICIENT_TRIGGERS_SELECTED' | translate }}</mat-error>
@@ -53,7 +53,7 @@
</div> </div>
<div class="aca-rule-details__form__row aca-rule-details__form__others" *ngIf="showOptionsSection"> <div class="aca-rule-details__form__row aca-rule-details__form__others" *ngIf="showOptionsSection">
<div class="aca-label">{{ 'ACA_FOLDER_RULES.RULE_DETAILS.LABEL.OPTIONS' | translate }}</div> <span id="rule-options-label" class="aca-label">{{ 'ACA_FOLDER_RULES.RULE_DETAILS.LABEL.OPTIONS' | translate }}</span>
<aca-rule-options <aca-rule-options
formControlName="options" formControlName="options"
data-automation-id="rule-details-options-component" data-automation-id="rule-details-options-component"
@@ -1,4 +1,5 @@
<div *ngFor="let trigger of triggerOptions"> <fieldset [attr.aria-labelledby]="ariaLabelledBy">
<div *ngFor="let trigger of triggerOptions">
<ng-container *ngIf="readOnly; else checkbox"> <ng-container *ngIf="readOnly; else checkbox">
<div <div
*ngIf="selectedTriggers[trigger]" *ngIf="selectedTriggers[trigger]"
@@ -15,4 +16,5 @@
{{ 'ACA_FOLDER_RULES.RULE_DETAILS.TRIGGERS.' + trigger | uppercase | translate }} {{ 'ACA_FOLDER_RULES.RULE_DETAILS.TRIGGERS.' + trigger | uppercase | translate }}
</mat-checkbox> </mat-checkbox>
</ng-template> </ng-template>
</div> </div>
</fieldset>
@@ -0,0 +1,7 @@
.aca-rule-triggers {
fieldset {
border: none;
padding: 0;
margin: 0;
}
}
@@ -23,7 +23,7 @@
*/ */
import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms'; import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';
import { Component, forwardRef, ViewEncapsulation } from '@angular/core'; import { Component, forwardRef, Input, ViewEncapsulation } from '@angular/core';
import { RuleTrigger } from '../../model/rule.model'; import { RuleTrigger } from '../../model/rule.model';
import { CommonModule } from '@angular/common'; import { CommonModule } from '@angular/common';
import { TranslatePipe } from '@ngx-translate/core'; import { TranslatePipe } from '@ngx-translate/core';
@@ -33,6 +33,7 @@ import { MatCheckboxModule } from '@angular/material/checkbox';
imports: [CommonModule, TranslatePipe, MatCheckboxModule], imports: [CommonModule, TranslatePipe, MatCheckboxModule],
selector: 'aca-rule-triggers', selector: 'aca-rule-triggers',
templateUrl: './rule-triggers.ui-component.html', templateUrl: './rule-triggers.ui-component.html',
styleUrls: ['./rule-triggers.ui-component.scss'],
encapsulation: ViewEncapsulation.None, encapsulation: ViewEncapsulation.None,
host: { class: 'aca-rule-triggers' }, host: { class: 'aca-rule-triggers' },
providers: [ providers: [
@@ -44,6 +45,8 @@ import { MatCheckboxModule } from '@angular/material/checkbox';
] ]
}) })
export class RuleTriggersUiComponent implements ControlValueAccessor { export class RuleTriggersUiComponent implements ControlValueAccessor {
@Input() ariaLabelledBy = 'rule-triggers-label';
readonly triggerOptions: RuleTrigger[] = ['inbound', 'update', 'outbound']; readonly triggerOptions: RuleTrigger[] = ['inbound', 'update', 'outbound'];
public selectedTriggers: { [key: string]: boolean } = { public selectedTriggers: { [key: string]: boolean } = {