Permalink
Browse files

Autocomplete: Don't react to the escape key if the menu isn't open. F…

…ixes #7579 - autocomplete overwrites input erroneously when user hits ESC before timeout expires.
  • Loading branch information...
scottgonzalez committed Oct 12, 2011
1 parent 84e9965 commit 75415b35eafbd09fbc804d6cfe6d9d6b6b65d17d
Showing with 4 additions and 2 deletions.
  1. +4 −2 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

0 comments on commit 75415b3

Please sign in to comment.