From: Scott González Date: Tue, 26 Oct 2010 13:05:38 +0000 (-0400) Subject: Autocomplete: Trigger close after hiding the menu. Fixes #6227 - Autocomplete: Don... X-Git-Tag: 1.8.7~47 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=f4d8ec9159b84718051b257715b97d22fba936e7;p=jquery-ui.git Autocomplete: Trigger close after hiding the menu. Fixes #6227 - Autocomplete: Don't trigger close event until after the menu is hidden. --- diff --git a/tests/unit/autocomplete/autocomplete_events.js b/tests/unit/autocomplete/autocomplete_events.js index a8924e192..95a86425c 100644 --- a/tests/unit/autocomplete/autocomplete_events.js +++ b/tests/unit/autocomplete/autocomplete_events.js @@ -28,7 +28,7 @@ test("all events", function() { }, close: function(event) { same(event.type, "autocompleteclose"); - same( $(".ui-menu:visible").length, 1 ); + same( $(".ui-menu:visible").length, 0 ); }, select: function(event, ui) { same(event.type, "autocompleteselect"); diff --git a/ui/jquery.ui.autocomplete.js b/ui/jquery.ui.autocomplete.js index 0ada32f02..1e07b3c16 100644 --- a/ui/jquery.ui.autocomplete.js +++ b/ui/jquery.ui.autocomplete.js @@ -295,9 +295,9 @@ $.widget( "ui.autocomplete", { close: function( event ) { clearTimeout( this.closing ); if ( this.menu.element.is(":visible") ) { - this._trigger( "close", event ); this.menu.element.hide(); this.menu.deactivate(); + this._trigger( "close", event ); } },