Skip to content

Commit b0917d5

Browse files
authoredMay 4, 2020
feat(ui5-multicombobox): Implement latest accessibility spec (#1564)
1 parent cdab106 commit b0917d5

File tree

6 files changed

+28
-8
lines changed

6 files changed

+28
-8
lines changed
 

‎packages/main/src/ComboBox.hbs

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
role="combobox"
2222
aria-haspopup="listbox"
2323
aria-autocomplete="both"
24-
aria-describedby="{{_id}}-valueStateDesc"
24+
aria-describedby="{{valueStateTextId}}"
2525
/>
2626

2727
{{#unless readonly}}
@@ -33,7 +33,7 @@
3333
?pressed="{{_iconPressed}}"
3434
@click="{{_arrowClick}}"
3535
dir="{{dir}}"
36-
accessibleName="{{_iconAccessibleNameText}}"
36+
accessible-name="{{_iconAccessibleNameText}}"
3737
></ui5-icon>
3838
{{/unless}}
3939
</div>

‎packages/main/src/ComboBox.js

+4
Original file line numberDiff line numberDiff line change
@@ -506,6 +506,10 @@ class ComboBox extends UI5Element {
506506
return this.valueStateTextMappings[this.valueState];
507507
}
508508

509+
get valueStateTextId() {
510+
return this.hasValueState ? `${this._id}-valueStateDesc` : undefined;
511+
}
512+
509513
get valueStateTextMappings() {
510514
return {
511515
"Success": this.i18nBundle.getText(VALUE_STATE_SUCCESS),

‎packages/main/src/MultiComboBox.hbs

+7-6
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
11
<div class="ui5-multi-combobox-root"
22
@focusin={{rootFocusIn}}
33
@focusout={{rootFocusOut}}
4-
role="combobox"
5-
aria-haspopup="listbox"
6-
aria-expanded="{{open}}"
74
>
85
<span id="{{_id}}-hiddenText-nMore" class="ui5-hidden-text">{{nMoreCountText}}</span>
9-
6+
107
{{#if hasValueState}}
118
<span id="{{_id}}-valueStateDesc" class="ui5-hidden-text">{{valueStateText}}</span>
129
{{/if}}
13-
10+
1411
<ui5-tokenizer slot="_beginContent"
1512
show-more
1613
class="ui5-multi-combobox-tokenizer"
@@ -50,9 +47,12 @@
5047
@focusin="{{_focusin}}"
5148
@focusout="{{_focusout}}"
5249
@click={{_click}}
50+
role="combobox"
51+
aria-haspopup="listbox"
52+
aria-expanded="{{open}}"
5353
aria-autocomplete="both"
5454
aria-labelledby="{{_id}}-hiddenText-nMore"
55-
aria-describedby="{{_id}}-valueStateDesc"
55+
aria-describedby="{{valueStateTextId}}"
5656
/>
5757

5858
{{#unless readonly}}
@@ -63,6 +63,7 @@
6363
@click={{_showAllItemsPopover}}
6464
?pressed="{{_iconPressed}}"
6565
dir="{{dir}}"
66+
accessible-name="{{_iconAccessibleNameText}}"
6667
></ui5-icon>
6768
{{/unless}}
6869
</div>

‎packages/main/src/MultiComboBox.js

+9
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import {
2626
TOKENIZER_ARIA_CONTAIN_ONE_TOKEN,
2727
TOKENIZER_ARIA_CONTAIN_SEVERAL_TOKENS,
2828
INPUT_SUGGESTIONS_TITLE,
29+
ICON_ACCESSIBLE_NAME,
2930
} from "./generated/i18n/i18n-defaults.js";
3031

3132
// Templates
@@ -679,6 +680,10 @@ class MultiComboBox extends UI5Element {
679680
return this.valueStateTextMappings[this.valueState];
680681
}
681682

683+
get valueStateTextId() {
684+
return this.hasValueState ? `${this._id}-valueStateDesc` : undefined;
685+
}
686+
682687
get _innerInput() {
683688
if (isPhone()) {
684689
if (this.allItemsPopover.opened) {
@@ -695,6 +700,10 @@ class MultiComboBox extends UI5Element {
695700
return this.i18nBundle.getText(INPUT_SUGGESTIONS_TITLE);
696701
}
697702

703+
get _iconAccessibleNameText() {
704+
return this.i18nBundle.getText(ICON_ACCESSIBLE_NAME);
705+
}
706+
698707
static async onDefine() {
699708
await Promise.all([
700709
MultiComboBoxItem.define(),

‎packages/main/src/Token.js

+2
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ class Token extends UI5Element {
131131

132132
_select() {
133133
this.fireEvent("select");
134+
this.selected = true;
134135
}
135136

136137
_delete() {
@@ -152,6 +153,7 @@ class Token extends UI5Element {
152153

153154
if (isEnter(event) || isSpace(event)) {
154155
this.fireEvent("select", {});
156+
this.selected = true;
155157
}
156158
}
157159

‎packages/main/src/themes/Token.css

+4
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,10 @@
6666
white-space: nowrap;
6767
}
6868

69+
:host([selected]) .ui5-token--icon {
70+
color: var(--sapButton_Selected_TextColor);
71+
}
72+
6973
.ui5-token--icon {
7074
color: inherit;
7175
cursor: pointer;

0 commit comments

Comments
 (0)
Please sign in to comment.