@@ -28,6 +28,9 @@ import {
28
28
VALUE_STATE_WARNING ,
29
29
INPUT_SUGGESTIONS ,
30
30
INPUT_SUGGESTIONS_TITLE ,
31
+ INPUT_SUGGESTIONS_ONE_HIT ,
32
+ INPUT_SUGGESTIONS_MORE_HITS ,
33
+ INPUT_SUGGESTIONS_NO_HIT ,
31
34
} from "./generated/i18n/i18n-defaults.js" ;
32
35
33
36
// Styles
@@ -993,11 +996,13 @@ class Input extends UI5Element {
993
996
get accInfo ( ) {
994
997
const ariaHasPopupDefault = this . showSuggestions ? "true" : undefined ;
995
998
const ariaAutoCompleteDefault = this . showSuggestions ? "list" : undefined ;
999
+ const ariaDescribedBy = this . _inputAccInfo . ariaDescribedBy ? `${ this . suggestionsTextId } ${ this . valueStateTextId } ${ this . _id } -suggestionsCount ${ this . _inputAccInfo . ariaDescribedBy } ` . trim ( ) : `${ this . suggestionsTextId } ${ this . valueStateTextId } ${ this . _id } -suggestionsCount` . trim ( ) ;
1000
+
996
1001
return {
997
1002
"wrapper" : {
998
1003
} ,
999
1004
"input" : {
1000
- "ariaDescribedBy" : this . _inputAccInfo . ariaDescribedBy ? ` ${ this . suggestionsTextId } ${ this . valueStateTextId } ${ this . _inputAccInfo . ariaDescribedBy } ` . trim ( ) : ` ${ this . suggestionsTextId } ${ this . valueStateTextId } ` . trim ( ) ,
1005
+ "ariaDescribedBy" : ariaDescribedBy ,
1001
1006
"ariaInvalid" : this . valueState === ValueState . Error ? "true" : undefined ,
1002
1007
"ariaHasPopup" : this . _inputAccInfo . ariaHasPopup ? this . _inputAccInfo . ariaHasPopup : ariaHasPopupDefault ,
1003
1008
"ariaAutoComplete" : this . _inputAccInfo . ariaAutoComplete ? this . _inputAccInfo . ariaAutoComplete : ariaAutoCompleteDefault ,
@@ -1073,6 +1078,23 @@ class Input extends UI5Element {
1073
1078
return this . i18nBundle . getText ( INPUT_SUGGESTIONS ) ;
1074
1079
}
1075
1080
1081
+ get availableSuggestionsCount ( ) {
1082
+ if ( this . showSuggestions ) {
1083
+ switch ( this . suggestionsTexts . length ) {
1084
+ case 0 :
1085
+ return this . i18nBundle . getText ( INPUT_SUGGESTIONS_NO_HIT ) ;
1086
+
1087
+ case 1 :
1088
+ return this . i18nBundle . getText ( INPUT_SUGGESTIONS_ONE_HIT ) ;
1089
+
1090
+ default :
1091
+ return this . i18nBundle . getText ( INPUT_SUGGESTIONS_MORE_HITS , this . suggestionsTexts . length ) ;
1092
+ }
1093
+ }
1094
+
1095
+ return undefined ;
1096
+ }
1097
+
1076
1098
get step ( ) {
1077
1099
return this . type === InputType . Number ? "any" : undefined ;
1078
1100
}
0 commit comments