@@ -22,6 +22,7 @@ $.widget( "ui.autocomplete", {
22
22
version : "@VERSION" ,
23
23
defaultElement : "<input>" ,
24
24
options : {
25
+ accessiblePopupText : "Autocomplete popup" ,
25
26
appendTo : "body" ,
26
27
autoFocus : false ,
27
28
delay : 300 ,
@@ -185,6 +186,8 @@ $.widget( "ui.autocomplete", {
185
186
self . close ( event ) ;
186
187
self . _change ( event ) ;
187
188
} ) ;
189
+
190
+ this . liveRegion = this . element . after ( "<span role='status' class='ui-helper-hidden-accessible' aria-live='polite'></span>" ) . next ( ) ;
188
191
this . _initSource ( ) ;
189
192
this . menu = $ ( "<ul></ul>" )
190
193
. addClass ( "ui-autocomplete" )
@@ -231,6 +234,7 @@ $.widget( "ui.autocomplete", {
231
234
self . _value ( item . value ) ;
232
235
}
233
236
}
237
+ self . liveRegion . text ( item . value ) ;
234
238
} ,
235
239
select : function ( event , ui ) {
236
240
// back compat for _renderItem using item.autocomplete, via #7810
@@ -265,6 +269,7 @@ $.widget( "ui.autocomplete", {
265
269
. zIndex ( this . element . zIndex ( ) + 1 )
266
270
. hide ( )
267
271
. data ( "menu" ) ;
272
+ this . menu . element . removeAttr ( "role" ) ;
268
273
269
274
if ( $ . fn . bgiframe ) {
270
275
this . menu . element . bgiframe ( ) ;
@@ -411,6 +416,7 @@ $.widget( "ui.autocomplete", {
411
416
_close : function ( event ) {
412
417
clearTimeout ( this . closing ) ;
413
418
if ( this . menu . element . is ( ":visible" ) ) {
419
+ this . liveRegion . text ( "" ) ;
414
420
this . menu . element . hide ( ) ;
415
421
this . menu . blur ( ) ;
416
422
this . _trigger ( "close" , event ) ;
@@ -461,6 +467,7 @@ $.widget( "ui.autocomplete", {
461
467
if ( this . options . autoFocus ) {
462
468
this . menu . next ( new $ . Event ( "mouseover" ) ) ;
463
469
}
470
+ this . liveRegion . text ( this . options . accessiblePopupText ) ;
464
471
} ,
465
472
466
473
_resizeMenu : function ( ) {
0 commit comments