Skip to content

Commit a6c5f52

Browse files
committed
Fixes AB#757: Reads multiselect listbox selected status
Because of quirkiness with Narrator, we place an aria-label at the option element with an explicit "selected/unselected" phrase, and set the nested content to be hidden to avoid reading twice.
1 parent 8dbbb6b commit a6c5f52

4 files changed

Lines changed: 20 additions & 3 deletions

File tree

desktop/i18n/resources.resjson

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,10 @@
374374
"resourcefile-picker.cloudFileDialog.title": "Pick file(s) from storage account",
375375
"select-dropdown.noMatch": "No match",
376376
"select-dropdown.noOptions": "No options available",
377+
"select-dropdown.selected": "Selected",
377378
"select-dropdown.showItems": "Showing {num} items",
379+
"select-dropdown.unselectAll": "Unselect all",
380+
"select-dropdown.unselected": "Unselected",
378381
"server-error.debug-button-label": "Toggle troubleshooting info",
379382
"settings.advancedSettings": "Advanced settings",
380383
"settings.gallerySettings": "Gallery settings",

desktop/src/@batch-flask/ui/select/select-dropdown/select-dropdown.component.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ export class SelectDropdownComponent {
121121
fixedOptions = [{
122122
id: unselectAllOptionId,
123123
value: unselectAllOptionId,
124-
label: "Unselect all",
124+
label: this.i18n.t("select-dropdown.unselectAll"),
125125
cssClass: "unselect-all-option"
126126
}];
127127
}
@@ -142,4 +142,14 @@ export class SelectDropdownComponent {
142142
);
143143
}
144144
}
145+
146+
public optionAriaLabel(option: SelectOptionComponent | any): string | null {
147+
if (!(option instanceof SelectOptionComponent) || option.disabled) {
148+
return null;
149+
}
150+
const selectLabel = this.selected.has(option.value)
151+
? this.i18n.t("select-dropdown.selected")
152+
: this.i18n.t("select-dropdown.unselected");
153+
return `${option.label}, ${selectLabel}`;
154+
}
145155
}

desktop/src/@batch-flask/ui/select/select-dropdown/select-dropdown.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@
66
[class.disabled]="option.disabled"
77
[attr.aria-disabled]="option.disabled"
88
[attr.aria-selected]="selected.has(option.value)"
9+
[attr.aria-label]="optionAriaLabel(option)"
910
(mousedown)="handleClickOption($event, option)">
1011

11-
<div class="checkbox" *ngIf="multiple" aria-hidden="true">
12+
<div class="checkbox" *ngIf="multiple">
1213
<i class="fa fa-check" *ngIf="selected.has(option.value)" aria-hidden="true"></i>
1314
</div>
14-
<div class="option-content">
15+
<div class="option-content" aria-hidden="true">
1516
<ng-container *ngIf="select.optionTemplate">
1617
<ng-template [ngTemplateOutlet]="select.optionTemplate" [ngTemplateOutletContext]="{$implicit: option.item}"></ng-template>
1718
</ng-container>

desktop/src/@batch-flask/ui/select/select-dropdown/select-dropdown.i18n.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,6 @@ select-dropdown:
22
noMatch: No match
33
noOptions: No options available
44
showItems: Showing {num} items
5+
unselectAll: Unselect all
6+
selected: Selected
7+
unselected: Unselected

0 commit comments

Comments
 (0)