Skip to content

Commit 8f8a0d4

Browse files
authoredAug 19, 2020
fix(ui5-input): announce custom valueStateMessage (#2120)
Previously just the buil-in text of a certain value state has been set to the hidden element that is being read out. Now the custom value state msg is also taken into account. Related to: #2106
1 parent 3588542 commit 8f8a0d4

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed
 

‎packages/main/src/Input.hbs

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
{{/if}}
5454

5555
{{#if hasValueState}}
56-
<span id="{{_id}}-valueStateDesc" class="ui5-hidden-text">{{valueStateText}}</span>
56+
<span id="{{_id}}-valueStateDesc" class="ui5-hidden-text">{{ariaValueStateHiddenText}}</span>
5757
{{/if}}
5858
</div>
5959

‎packages/main/src/Input.js

+12
Original file line numberDiff line numberDiff line change
@@ -1018,6 +1018,18 @@ class Input extends UI5Element {
10181018
};
10191019
}
10201020

1021+
get ariaValueStateHiddenText() {
1022+
if (!this.hasValueStateMessage) {
1023+
return;
1024+
}
1025+
1026+
if (this.shouldDisplayDefaultValueStateMessage) {
1027+
return this.valueStateText;
1028+
}
1029+
1030+
return this.valueStateMessageText.map(el => el.textContent).join(" ");
1031+
}
1032+
10211033
get itemSelectionAnnounce() {
10221034
return this.Suggestions ? this.Suggestions.itemSelectionAnnounce : undefined;
10231035
}

0 commit comments

Comments
 (0)
Please sign in to comment.