File tree 3 files changed +14
-5
lines changed
3 files changed +14
-5
lines changed Original file line number Diff line number Diff line change @@ -1047,16 +1047,18 @@ class Input extends UI5Element {
1047
1047
return this . hasValueState ? `${ this . _id } -valueStateDesc` : "" ;
1048
1048
}
1049
1049
1050
+ get suggestionsCount ( ) {
1051
+ return this . showSuggestions ? `${ this . _id } -suggestionsCount` : "" ;
1052
+ }
1053
+
1050
1054
get accInfo ( ) {
1051
1055
const ariaHasPopupDefault = this . showSuggestions ? "true" : undefined ;
1052
1056
const ariaAutoCompleteDefault = this . showSuggestions ? "list" : undefined ;
1053
- const ariaDescribedBy = this . _inputAccInfo . ariaDescribedBy ? `${ this . suggestionsTextId } ${ this . valueStateTextId } ${ this . _id } - suggestionsCount ${ this . _inputAccInfo . ariaDescribedBy } ` . trim ( ) : `${ this . suggestionsTextId } ${ this . valueStateTextId } ${ this . _id } - suggestionsCount` . trim ( ) ;
1057
+ const ariaDescribedBy = this . _inputAccInfo . ariaDescribedBy ? `${ this . suggestionsTextId } ${ this . valueStateTextId } ${ this . suggestionsCount } ${ this . _inputAccInfo . ariaDescribedBy } ` . trim ( ) : `${ this . suggestionsTextId } ${ this . valueStateTextId } ${ this . suggestionsCount } ` . trim ( ) ;
1054
1058
1055
1059
return {
1056
- "wrapper" : {
1057
- } ,
1058
1060
"input" : {
1059
- "ariaDescribedBy" : ariaDescribedBy ,
1061
+ "ariaDescribedBy" : ariaDescribedBy || undefined ,
1060
1062
"ariaInvalid" : this . valueState === ValueState . Error ? "true" : undefined ,
1061
1063
"ariaHasPopup" : this . _inputAccInfo . ariaHasPopup ? this . _inputAccInfo . ariaHasPopup : ariaHasPopupDefault ,
1062
1064
"ariaAutoComplete" : this . _inputAccInfo . ariaAutoComplete ? this . _inputAccInfo . ariaAutoComplete : ariaAutoCompleteDefault ,
Original file line number Diff line number Diff line change @@ -78,7 +78,7 @@ <h3> Input disabled</h3>
78
78
< input />
79
79
80
80
< h3 > Input maxLength = 5</ h3 >
81
- < ui5-input maxLength ="5 " placeholder ="Max length of 5 "> </ ui5-input >
81
+ < ui5-input id =" input-max-length " maxLength ="5 " placeholder ="Max length of 5 "> </ ui5-input >
82
82
83
83
< h3 > Input valueState Success</ h3 >
84
84
< ui5-input id ="input3 " value-state ="Success " placeholder ="Success state ... ">
Original file line number Diff line number Diff line change @@ -289,6 +289,13 @@ describe("Input general interaction", () => {
289
289
assert . ok ( respPopover , "Responsive popover with valueStateMessage should be opened." ) ;
290
290
} ) ;
291
291
292
+ it ( "Checks if aria-describedby is renderd if not neccessary" , ( ) => {
293
+ const input = browser . $ ( "#input-max-length" ) ; // Input with no show-suggestions attribute
294
+ const innerInput = input . shadow$ ( "input" ) ;
295
+
296
+ assert . notOk ( innerInput . getAttribute ( "aria-describedby" ) , "aria-describedby is not rendered" ) ;
297
+ } ) ;
298
+
292
299
it ( "Checks if aria-label is reflected in the shadow DOM" , ( ) => {
293
300
const input = browser . $ ( "#aria-label-input" ) ;
294
301
const innerInput = input . shadow$ ( "input" ) ;
You can’t perform that action at this time.
0 commit comments