From: Scott González Date: Wed, 12 Oct 2011 20:25:59 +0000 (-0400) Subject: Autocomplete: Don't react to the escape key if the menu isn't open. Fixes #7579 ... X-Git-Tag: 1.9m7~195 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=75415b35eafbd09fbc804d6cfe6d9d6b6b65d17d;p=jquery-ui.git Autocomplete: Don't react to the escape key if the menu isn't open. Fixes #7579 - autocomplete overwrites input erroneously when user hits ESC before timeout expires. --- diff --git a/ui/jquery.ui.autocomplete.js b/ui/jquery.ui.autocomplete.js index 853de21ae..2618597b1 100644 --- a/ui/jquery.ui.autocomplete.js +++ b/ui/jquery.ui.autocomplete.js @@ -110,8 +110,10 @@ $.widget( "ui.autocomplete", { self.menu.select( event ); break; case keyCode.ESCAPE: - self._value( self.term ); - self.close( event ); + if ( self.menu.element.is(":visible") ) { + self._value( self.term ); + self.close( event ); + } break; default: // search timeout should be triggered before the input value is changed