@@ -233,7 +233,9 @@ class ButtonElement(InteractiveElement):
233233
234234 @property
235235 def attributes (self ) -> Set [str ]:
236- return super ().attributes .union ({"text" , "url" , "value" , "style" , "confirm" })
236+ return super ().attributes .union (
237+ {"text" , "url" , "value" , "style" , "confirm" , "accessibility_label" }
238+ )
237239
238240 def __init__ (
239241 self ,
@@ -244,6 +246,7 @@ def __init__(
244246 value : Optional [str ] = None ,
245247 style : Optional [str ] = None , # primary, danger
246248 confirm : Optional [Union [dict , ConfirmObject ]] = None ,
249+ accessibility_label : Optional [str ] = None ,
247250 ** others : dict ,
248251 ):
249252 """An interactive element that inserts a button. The button can be a trigger for
@@ -271,6 +274,9 @@ def __init__(
271274 Use "danger" even more sparingly than "primary".
272275 If you don't include this field, the default button style will be used.
273276 confirm: A confirm object that defines an optional confirmation dialog after the button is clicked.
277+ accessibility_label: A label for longer descriptive text about a button element.
278+ This label will be read out by screen readers instead of the button text object.
279+ Maximum length for this field is 75 characters.
274280 """
275281 super ().__init__ (action_id = action_id , type = self .type )
276282 show_unknown_key_warning (self , others )
@@ -281,6 +287,7 @@ def __init__(
281287 self .value = value
282288 self .style = style
283289 self .confirm = ConfirmObject .parse (confirm )
290+ self .accessibility_label = accessibility_label
284291
285292 @JsonValidator (f"text attribute cannot exceed { text_max_length } characters" )
286293 def _validate_text_length (self ) -> bool :
@@ -302,6 +309,15 @@ def _validate_value_length(self) -> bool:
302309 def _validate_style_valid (self ):
303310 return self .style is None or self .style in ButtonStyles
304311
312+ @JsonValidator (
313+ f"accessibility_label attribute cannot exceed { text_max_length } characters"
314+ )
315+ def _validate_accessibility_label_length (self ) -> bool :
316+ return (
317+ self .accessibility_label is None
318+ or len (self .accessibility_label ) <= self .text_max_length
319+ )
320+
305321
306322class LinkButtonElement (ButtonElement ):
307323 def __init__ (
0 commit comments