@@ -28,6 +28,9 @@ import {
2828 VALUE_STATE_WARNING ,
2929 INPUT_SUGGESTIONS ,
3030 INPUT_SUGGESTIONS_TITLE ,
31+ INPUT_SUGGESTIONS_ONE_HIT ,
32+ INPUT_SUGGESTIONS_MORE_HITS ,
33+ INPUT_SUGGESTIONS_NO_HIT ,
3134} from "./generated/i18n/i18n-defaults.js" ;
3235
3336// Styles
@@ -992,11 +995,13 @@ class Input extends UI5Element {
992995 get accInfo ( ) {
993996 const ariaHasPopupDefault = this . showSuggestions ? "true" : undefined ;
994997 const ariaAutoCompleteDefault = this . showSuggestions ? "list" : undefined ;
998+ const ariaDescribedBy = this . _inputAccInfo . ariaDescribedBy ? `${ this . suggestionsTextId } ${ this . valueStateTextId } ${ this . _id } -suggestionsCount ${ this . _inputAccInfo . ariaDescribedBy } ` . trim ( ) : `${ this . suggestionsTextId } ${ this . valueStateTextId } ${ this . _id } -suggestionsCount` . trim ( ) ;
999+
9951000 return {
9961001 "wrapper" : {
9971002 } ,
9981003 "input" : {
999- "ariaDescribedBy" : this . _inputAccInfo . ariaDescribedBy ? ` ${ this . suggestionsTextId } ${ this . valueStateTextId } ${ this . _inputAccInfo . ariaDescribedBy } ` . trim ( ) : ` ${ this . suggestionsTextId } ${ this . valueStateTextId } ` . trim ( ) ,
1004+ "ariaDescribedBy" : ariaDescribedBy ,
10001005 "ariaInvalid" : this . valueState === ValueState . Error ? "true" : undefined ,
10011006 "ariaHasPopup" : this . _inputAccInfo . ariaHasPopup ? this . _inputAccInfo . ariaHasPopup : ariaHasPopupDefault ,
10021007 "ariaAutoComplete" : this . _inputAccInfo . ariaAutoComplete ? this . _inputAccInfo . ariaAutoComplete : ariaAutoCompleteDefault ,
@@ -1072,6 +1077,23 @@ class Input extends UI5Element {
10721077 return this . i18nBundle . getText ( INPUT_SUGGESTIONS ) ;
10731078 }
10741079
1080+ get availableSuggestionsCount ( ) {
1081+ if ( this . showSuggestions ) {
1082+ switch ( this . suggestionsTexts . length ) {
1083+ case 0 :
1084+ return this . i18nBundle . getText ( INPUT_SUGGESTIONS_NO_HIT ) ;
1085+
1086+ case 1 :
1087+ return this . i18nBundle . getText ( INPUT_SUGGESTIONS_ONE_HIT ) ;
1088+
1089+ default :
1090+ return this . i18nBundle . getText ( INPUT_SUGGESTIONS_MORE_HITS , this . suggestionsTexts . length ) ;
1091+ }
1092+ }
1093+
1094+ return undefined ;
1095+ }
1096+
10751097 get step ( ) {
10761098 return this . type === InputType . Number ? "any" : undefined ;
10771099 }
0 commit comments