mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-10-05 01:44:18 +00:00
Autocomplete: Fixed a few places that got missed during the change to always keep the menu element around.
Fixes a bug where opening the menu using the arrow keys would cycle through the options, but not show the menu. There's now a bug where you have to arrow too many times to get into the menu when showing the menu by using the arrow keys.
This commit is contained in:
parent
f349f9080b
commit
1402650134
9
ui/jquery.ui.autocomplete.js
vendored
9
ui/jquery.ui.autocomplete.js
vendored
@ -92,7 +92,7 @@ $.widget( "ui.autocomplete", {
|
|||||||
this.response = function() {
|
this.response = function() {
|
||||||
return self._response.apply( self, arguments );
|
return self._response.apply( self, arguments );
|
||||||
};
|
};
|
||||||
this.menu = $("<ul></ul>")
|
this.menu = $( "<ul></ul>" )
|
||||||
.addClass( "ui-autocomplete" )
|
.addClass( "ui-autocomplete" )
|
||||||
.appendTo( this.element.parent() )
|
.appendTo( this.element.parent() )
|
||||||
.menu({
|
.menu({
|
||||||
@ -139,9 +139,7 @@ $.widget( "ui.autocomplete", {
|
|||||||
.removeAttr( "role" )
|
.removeAttr( "role" )
|
||||||
.removeAttr( "aria-autocomplete" )
|
.removeAttr( "aria-autocomplete" )
|
||||||
.removeAttr( "aria-haspopup" );
|
.removeAttr( "aria-haspopup" );
|
||||||
if ( this.menu ) {
|
|
||||||
this.menu.element.remove();
|
this.menu.element.remove();
|
||||||
}
|
|
||||||
$.Widget.prototype.destroy.call( this );
|
$.Widget.prototype.destroy.call( this );
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -237,8 +235,7 @@ $.widget( "ui.autocomplete", {
|
|||||||
},
|
},
|
||||||
|
|
||||||
_suggest: function( items ) {
|
_suggest: function( items ) {
|
||||||
this.menu.element.empty();
|
var ul = this.menu.element.empty();
|
||||||
var ul = this.menu.element;
|
|
||||||
$.each( items, function( index, item ) {
|
$.each( items, function( index, item ) {
|
||||||
$( "<li></li>" )
|
$( "<li></li>" )
|
||||||
.data( "item.autocomplete", item )
|
.data( "item.autocomplete", item )
|
||||||
@ -253,7 +250,7 @@ $.widget( "ui.autocomplete", {
|
|||||||
},
|
},
|
||||||
|
|
||||||
_move: function( direction, event ) {
|
_move: function( direction, event ) {
|
||||||
if ( !this.menu ) {
|
if ( !this.menu.element.is(":visible") ) {
|
||||||
this.search( null, event );
|
this.search( null, event );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user