Skip to content

Commit

Permalink
fix(ui5-input): announce custom valueStateMessage (#2120)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
ilhan007 authored Aug 19, 2020
1 parent 3588542 commit 8f8a0d4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/main/src/Input.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
{{/if}}

{{#if hasValueState}}
<span id="{{_id}}-valueStateDesc" class="ui5-hidden-text">{{valueStateText}}</span>
<span id="{{_id}}-valueStateDesc" class="ui5-hidden-text">{{ariaValueStateHiddenText}}</span>
{{/if}}
</div>

Expand Down
12 changes: 12 additions & 0 deletions packages/main/src/Input.js
Original file line number Diff line number Diff line change
Expand Up @@ -1018,6 +1018,18 @@ class Input extends UI5Element {
};
}

get ariaValueStateHiddenText() {
if (!this.hasValueStateMessage) {
return;
}

if (this.shouldDisplayDefaultValueStateMessage) {
return this.valueStateText;
}

return this.valueStateMessageText.map(el => el.textContent).join(" ");
}

get itemSelectionAnnounce() {
return this.Suggestions ? this.Suggestions.itemSelectionAnnounce : undefined;
}
Expand Down

0 comments on commit 8f8a0d4

Please sign in to comment.