]> source.dussan.org Git - jquery-ui.git/commitdiff
Autocomplete: Don't react to the escape key if the menu isn't open. Fixes #7579 ...
authorScott González <scott.gonzalez@gmail.com>
Wed, 12 Oct 2011 20:25:59 +0000 (16:25 -0400)
committerScott González <scott.gonzalez@gmail.com>
Wed, 12 Oct 2011 20:25:59 +0000 (16:25 -0400)
ui/jquery.ui.autocomplete.js

index 853de21ae4af92019f0d10dc45ea86c5ffd5de3b..2618597b14bac7cfdcc9c66da0f07460b43bb294 100644 (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