diff --git a/misc/autocomplete.js b/misc/autocomplete.js
old mode 100644
new mode 100755
index 5e85be4..46dca36
--- a/misc/autocomplete.js
+++ b/misc/autocomplete.js
@@ -65,6 +65,11 @@ Drupal.jsAC.prototype.onkeydown = function (input, e) {
     case 38: // up arrow.
       this.selectUp();
       return false;
+    case 9:  // Tab.
+    case 13: // Enter.
+    case 27: // Esc.
+      this.hidePopup(e.keyCode);
+      return true;
     default: // All other keys.
       return true;
   }
