Autocomplete: Fix for #5154

This commit is contained in:
Jörn Zaefferer 2010-02-10 15:05:35 +00:00
parent 5eeaa658ba
commit 3875cd33b7

View File

@ -240,6 +240,7 @@ $.widget( "ui.autocomplete", {
$.each( items, function( index, item ) { $.each( items, function( index, item ) {
self._renderItem( ul, item ); self._renderItem( ul, item );
}); });
this.menu.deactivate();
this.menu.refresh(); this.menu.refresh();
this.menu.element.show(); this.menu.element.show();
if ( ul.width() <= this.element.width() ) { if ( ul.width() <= this.element.width() ) {
@ -255,12 +256,15 @@ $.widget( "ui.autocomplete", {
}, },
_move: function( direction, event ) { _move: function( direction, event ) {
console.log("move " + direction + " with event " + event)
if ( !this.menu.element.is(":visible") ) { if ( !this.menu.element.is(":visible") ) {
console.log("move, menu not visible")
this.search( null, event ); this.search( null, event );
return; return;
} }
if ( this.menu.first() && /^previous/.test(direction) || if ( this.menu.first() && /^previous/.test(direction) ||
this.menu.last() && /^next/.test(direction) ) { this.menu.last() && /^next/.test(direction) ) {
console.log("move, first or last")
this.element.val( this.term ); this.element.val( this.term );
this.menu.deactivate(); this.menu.deactivate();
return; return;