File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -88,6 +88,7 @@ interface IOption extends UI5Element {
8888 text ?: Array < Node > ,
8989 stableDomRef : string ,
9090 displayText ?: string ,
91+ accessibleName ?: string ,
9192}
9293
9394type SelectChangeEventDetail = {
@@ -1110,7 +1111,8 @@ class Select extends UI5Element implements IFormElement {
11101111 const itemPositionText = Select . i18nBundle . getText ( LIST_ITEM_POSITION , this . _selectedIndex + 1 , optionsCount ) ;
11111112
11121113 if ( this . focused && this . _currentlySelectedOption ) {
1113- text = `${ this . _currentlySelectedOption . textContent as string } ${ this . _isPickerOpen ? itemPositionText : "" } ` ;
1114+ const optionText = this . _currentlySelectedOption . getAttribute ( "accessible-name" ) || this . _currentlySelectedOption . textContent as string ;
1115+ text = `${ optionText } ${ this . _isPickerOpen ? `, ${ itemPositionText } ` : "" } ` ;
11141116
11151117 announce ( text , InvisibleMessageMode . Polite ) ;
11161118 }
Original file line number Diff line number Diff line change @@ -150,4 +150,20 @@ describe("Select Menu general interaction", () => {
150150
151151 assert . strictEqual ( await inpTestChange . getProperty ( "value" ) , "1" , "Change event should be fired after focus out" ) ;
152152 } ) ;
153+
154+ it ( "Tests accessible-name on SelectMenuOption" , async ( ) => {
155+ const menu = await browser . $ ( "#selectOptions" ) ;
156+ const options = await menu . $$ ( "ui5-select-menu-option" ) ;
157+
158+ const EXPECTED_FIRST_OPTION_ACCESSIBLE_NAME = "T-shirt size S" ;
159+ const EXPECTED_SECOND_OPTION_ACCESSIBLE_NAME = "Dress size M" ;
160+ const EXPECTED_THIRD_OPTION_ACCESSIBLE_NAME = "Skirt size L" ;
161+
162+ assert . strictEqual ( await options [ 0 ] . getProperty ( "accessibleName" ) , EXPECTED_FIRST_OPTION_ACCESSIBLE_NAME ,
163+ "The accessible-name property on first ui5-select-menu-option is correctly set." ) ;
164+ assert . strictEqual ( await options [ 1 ] . getProperty ( "accessibleName" ) , EXPECTED_SECOND_OPTION_ACCESSIBLE_NAME ,
165+ "The accessible-name property on second ui5-select-menu-option is correctly set." ) ;
166+ assert . strictEqual ( await options [ 2 ] . getProperty ( "accessibleName" ) , EXPECTED_THIRD_OPTION_ACCESSIBLE_NAME ,
167+ "The accessible-name property on third ui5-select-menu-option is correctly set." ) ;
168+ } ) ;
153169} ) ;
You can’t perform that action at this time.
0 commit comments