Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch 'autocomplete' of https://github.com/ezufelt/jquery-ui i…

…nto autocomplete-aria
  • Loading branch information...
commit e39fd922d3eac6c3925d8373f6eb9792edeaf4d9 2 parents 2357d6d + 0275260
@scottgonzalez scottgonzalez authored
Showing with 7 additions and 0 deletions.
  1. +7 −0 ui/jquery.ui.autocomplete.js
View
7 ui/jquery.ui.autocomplete.js
@@ -22,6 +22,7 @@ $.widget( "ui.autocomplete", {
version: "@VERSION",
defaultElement: "<input>",
options: {
+ accessiblePopupText: "Autocomplete popup",
appendTo: "body",
autoFocus: false,
delay: 300,
@@ -185,6 +186,8 @@ $.widget( "ui.autocomplete", {
self.close( event );
self._change( event );
});
+
+ this.liveRegion = this.element.after("<span role='status' class='ui-helper-hidden-accessible' aria-live='polite'></span>").next();
this._initSource();
this.menu = $( "<ul></ul>" )
.addClass( "ui-autocomplete" )
@@ -231,6 +234,7 @@ $.widget( "ui.autocomplete", {
self._value( item.value );
}
}
+ self.liveRegion.text(item.value);
},
select: function( event, ui ) {
// back compat for _renderItem using item.autocomplete, via #7810
@@ -265,6 +269,7 @@ $.widget( "ui.autocomplete", {
.zIndex( this.element.zIndex() + 1 )
.hide()
.data( "menu" );
+ this.menu.element.removeAttr("role");
if ( $.fn.bgiframe ) {
this.menu.element.bgiframe();
@@ -411,6 +416,7 @@ $.widget( "ui.autocomplete", {
_close: function( event ) {
clearTimeout( this.closing );
if ( this.menu.element.is(":visible") ) {
+ this.liveRegion.text("");
this.menu.element.hide();
this.menu.blur();
this._trigger( "close", event );
@@ -461,6 +467,7 @@ $.widget( "ui.autocomplete", {
if ( this.options.autoFocus ) {
this.menu.next( new $.Event("mouseover") );
}
+ this.liveRegion.text(this.options.accessiblePopupText);
},
_resizeMenu: function() {
Please sign in to comment.
Something went wrong with that request. Please try again.