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.

This commit is contained in:
Scott González
2011-10-12 16:25:59 -04:00
parent 84e99650bf
commit 75415b35ea

View File

@@ -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