diff --git a/hinter.js b/hinter.js index e43c4c7..f0e0169 100644 --- a/hinter.js +++ b/hinter.js @@ -378,7 +378,7 @@ SimpleAutocomplete.prototype.onChange = function() SimpleAutocomplete.prototype.onKeyUp = function(ev) { ev = ev||window.event; - if (ev.keyCode != 10 && ev.keyCode != 13) + if (ev.keyCode == 38 || ev.keyCode == 40) this.show(); if (ev.keyCode == 38 || ev.keyCode == 40 || ev.keyCode == 10 || ev.keyCode == 13) { @@ -421,6 +421,11 @@ SimpleAutocomplete.prototype.onKeyPress = function(ev) this.selectItem(this.selectedIndex); return stopEvent(ev, true, true); } + else if (ev.keyCode == 27) // escape + { + this.hide(); + return stopEvent(ev, true, true); + } else return true; // scrolling @@ -441,6 +446,8 @@ SimpleAutocomplete.prototype.onKeyPress = function(ev) // Called when input receives focus SimpleAutocomplete.prototype.onInputFocus = function() { + if (this.disabledUntil) + this.enable(); this.show(); this.input.autocomplete = 'off'; this.hasFocus = true;