File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -831,3 +831,32 @@ describe("ToolbarButton", () => {
831831 } ) ;
832832} ) ;
833833
834+ describe ( "Toolbar overflow button accessible name" , ( ) => {
835+ it ( "should use the default i18n accessible name when overflowButtonAccessibleName is not set" , ( ) => {
836+ cy . mount (
837+ < Toolbar >
838+ < ToolbarButton text = "Add" icon = "add" overflow-priority = "AlwaysOverflow" > </ ToolbarButton >
839+ </ Toolbar >
840+ ) ;
841+
842+ cy . get ( "[ui5-toolbar]" )
843+ . shadow ( )
844+ . find ( ".ui5-tb-overflow-btn" )
845+ . should ( "not.have.class" , "ui5-tb-overflow-btn-hidden" )
846+ . should ( "have.attr" , "accessible-name" , "Additional Options" ) ;
847+ } ) ;
848+
849+ it ( "should use the custom accessible name when overflowButtonAccessibleName is set" , ( ) => {
850+ cy . mount (
851+ < Toolbar overflow-button-accessible-name = "More actions for Opportunity 123" >
852+ < ToolbarButton text = "Add" icon = "add" overflow-priority = "AlwaysOverflow" > </ ToolbarButton >
853+ </ Toolbar >
854+ ) ;
855+
856+ cy . get ( "[ui5-toolbar]" )
857+ . shadow ( )
858+ . find ( ".ui5-tb-overflow-btn" )
859+ . should ( "not.have.class" , "ui5-tb-overflow-btn-hidden" )
860+ . should ( "have.attr" , "accessible-name" , "More actions for Opportunity 123" ) ;
861+ } ) ;
862+ } ) ;
Original file line number Diff line number Diff line change @@ -134,6 +134,17 @@ class Toolbar extends UI5Element {
134134 @property ( )
135135 accessibleNameRef ?: string ;
136136
137+ /**
138+ * Defines the accessible ARIA name of the overflow button of the component.
139+ *
140+ * **Note:** When not set, the built-in translation for "Additional Options" is used.
141+ * @default undefined
142+ * @public
143+ * @since 2.22.0
144+ */
145+ @property ( )
146+ overflowButtonAccessibleName ?: string ;
147+
137148 /**
138149 * Defines the toolbar design.
139150 * @public
@@ -242,7 +253,7 @@ class Toolbar extends UI5Element {
242253 accessibleName : this . ariaLabelText ,
243254 } ,
244255 overflowButton : {
245- accessibleName : Toolbar . i18nBundle . getText ( TOOLBAR_OVERFLOW_BUTTON_ARIA_LABEL ) ,
256+ accessibleName : this . overflowButtonAccessibleName || Toolbar . i18nBundle . getText ( TOOLBAR_OVERFLOW_BUTTON_ARIA_LABEL ) ,
246257 tooltip : Toolbar . i18nBundle . getText ( TOOLBAR_OVERFLOW_BUTTON_ARIA_LABEL ) ,
247258 accessibilityAttributes : {
248259 expanded : this . popoverOpen ,
Original file line number Diff line number Diff line change 158158
159159 < br /> < br />
160160
161+ < ui5-title level ="H3 "> Toolbar with custom overflow button accessible name</ ui5-title >
162+ < br />
163+
164+ < section >
165+ < ui5-toolbar overflow-button-accessible-name ="More actions for Opportunity 123 ">
166+ < ui5-toolbar-button icon ="add " text ="Left 1 (long) " width ="150px "> </ ui5-toolbar-button >
167+ < ui5-toolbar-button icon ="decline " text ="Left 2 "> </ ui5-toolbar-button >
168+ < ui5-toolbar-button icon ="employee " text ="Call me later " overflow-priority ="AlwaysOverflow "> </ ui5-toolbar-button >
169+ </ ui5-toolbar >
170+ </ section >
171+
172+ < br /> < br />
173+
161174 < ui5-title level ="H3 "> Toolbar with "NeverOverflow" overflow priority item (divided visually by internal
162175 separator)</ ui5-title >
163176 < br />
You can’t perform that action at this time.
0 commit comments