File tree 4 files changed +32
-9
lines changed
4 files changed +32
-9
lines changed Original file line number Diff line number Diff line change @@ -1080,14 +1080,10 @@ class Input extends UI5Element {
1080
1080
return this . hasValueState ? `${ this . _id } -valueStateDesc` : "" ;
1081
1081
}
1082
1082
1083
- get suggestionsCount ( ) {
1084
- return this . showSuggestions ? `${ this . _id } -suggestionsCount` : "" ;
1085
- }
1086
-
1087
1083
get accInfo ( ) {
1088
1084
const ariaHasPopupDefault = this . showSuggestions ? "true" : undefined ;
1089
1085
const ariaAutoCompleteDefault = this . showSuggestions ? "list" : undefined ;
1090
- const ariaDescribedBy = this . _inputAccInfo . ariaDescribedBy ? `${ this . suggestionsTextId } ${ this . valueStateTextId } ${ this . suggestionsCount } ${ this . _inputAccInfo . ariaDescribedBy } ` . trim ( ) : `${ this . suggestionsTextId } ${ this . valueStateTextId } ${ this . suggestionsCount } ` . trim ( ) ;
1086
+ const ariaDescribedBy = this . _inputAccInfo . ariaDescribedBy ? `${ this . suggestionsTextId } ${ this . valueStateTextId } ${ this . _inputAccInfo . ariaDescribedBy } ` . trim ( ) : `${ this . suggestionsTextId } ${ this . valueStateTextId } ` . trim ( ) ;
1091
1087
1092
1088
return {
1093
1089
"input" : {
@@ -1200,7 +1196,7 @@ class Input extends UI5Element {
1200
1196
}
1201
1197
1202
1198
get availableSuggestionsCount ( ) {
1203
- if ( this . showSuggestions ) {
1199
+ if ( this . showSuggestions && ( this . value || this . Suggestions . isOpened ( ) ) ) {
1204
1200
switch ( this . suggestionsTexts . length ) {
1205
1201
case 0 :
1206
1202
return this . i18nBundle . getText ( INPUT_SUGGESTIONS_NO_HIT ) ;
Original file line number Diff line number Diff line change @@ -280,7 +280,7 @@ class MultiInput extends Input {
280
280
}
281
281
282
282
get accInfo ( ) {
283
- const ariaDescribedBy = `${ this . _tokensCountTextId } ${ this . suggestionsTextId } ${ this . valueStateTextId } ${ this . suggestionsCount } ` . trim ( ) ;
283
+ const ariaDescribedBy = `${ this . _tokensCountTextId } ${ this . suggestionsTextId } ${ this . valueStateTextId } ` . trim ( ) ;
284
284
return {
285
285
"input" : {
286
286
...super . accInfo . input ,
Original file line number Diff line number Diff line change @@ -458,4 +458,32 @@ describe("Input general interaction", () => {
458
458
assert . notOk ( popover . isDisplayedInViewport ( ) , "The popover is not visible" ) ;
459
459
assert . ok ( dialog . isDisplayedInViewport ( ) , "The dialog is opened." ) ;
460
460
} ) ;
461
+
462
+ it ( "Suggestions count should be read out when necessary" , ( ) => {
463
+ browser . url ( `http://localhost:${ PORT } /test-resources/pages/Input.html` ) ;
464
+
465
+ const inputDynamicSuggestions = $ ( "#inputCompact" ) ;
466
+ const inputSuggestions = $ ( "#myInput2" ) ;
467
+ const dynamicSuggestionsInnerInput = inputDynamicSuggestions . shadow$ ( "input" ) ;
468
+ const dynamicSuggestionsCount = inputDynamicSuggestions . shadow$ ( `#${ inputDynamicSuggestions . getProperty ( "_id" ) } -suggestionsCount` ) ;
469
+ const suggestionsCount = inputSuggestions . shadow$ ( `#${ inputSuggestions . getProperty ( "_id" ) } -suggestionsCount` ) ;
470
+
471
+ //act
472
+ dynamicSuggestionsInnerInput . click ( ) ;
473
+
474
+ //assert
475
+ assert . strictEqual ( dynamicSuggestionsCount . getText ( ) , "" , "Suggestions count is not available" ) ;
476
+
477
+ //act
478
+ dynamicSuggestionsInnerInput . keys ( "c" ) ;
479
+
480
+ //assert
481
+ assert . strictEqual ( dynamicSuggestionsCount . getText ( ) , "4 results are available" , "Suggestions count is available since value is entered" ) ;
482
+ dynamicSuggestionsInnerInput . keys ( "Backspace" ) ;
483
+ //act
484
+ inputSuggestions . click ( ) ;
485
+
486
+ //assert
487
+ assert . strictEqual ( suggestionsCount . getText ( ) , "5 results are available" , "Suggestions count is available since the suggestions popover is opened" ) ;
488
+ } ) ;
461
489
} ) ;
Original file line number Diff line number Diff line change @@ -175,8 +175,7 @@ describe("ARIA attributes", () => {
175
175
const innerInput = mi . shadow$ ( "input" ) ;
176
176
const tokensCountITextId = `${ mi . getProperty ( "_id" ) } -hiddenText-nMore` ;
177
177
const suggestionsITextId = `${ mi . getProperty ( "_id" ) } -suggestionsText` ;
178
- const suggestionsCountITextId = `${ mi . getProperty ( "_id" ) } -suggestionsCount` ;
179
- const ariaDescribedBy = `${ tokensCountITextId } ${ suggestionsITextId } ${ suggestionsCountITextId } ` ;
178
+ const ariaDescribedBy = `${ tokensCountITextId } ${ suggestionsITextId } ` ;
180
179
181
180
$ ( "#suggestion-token" ) . scrollIntoView ( ) ;
182
181
innerInput . click ( ) ;
You can’t perform that action at this time.
0 commit comments