Skip to content

Commit

Permalink
Enable Escape key to close tag suggestion popup
Browse files Browse the repository at this point in the history
closes #1893
- Checking the contents of search term after evaluating the keycode caused the suggestion box to be hidden and immediately reshown
- Moving the if/else to the top of the function enables us to fix the issue without complicating the suggestion update logic
  • Loading branch information
Damiya committed Jan 14, 2014
1 parent c82d2ea commit 4dbf57f
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions core/client/views/editor-tag-widget.js
Expand Up @@ -134,6 +134,12 @@
var $target = $(e.currentTarget),
searchTerm = $.trim($target.val());

if (searchTerm) {
this.showSuggestions($target, searchTerm);
} else {
this.$suggestions.hide();
}

if (e.keyCode === this.keys.UP) {
e.preventDefault();
if (this.$suggestions.is(":visible")) {
Expand All @@ -159,12 +165,6 @@
if (e.keyCode === this.keys.UP || e.keyCode === this.keys.DOWN) {
return false;
}

if (searchTerm) {
this.showSuggestions($target, searchTerm);
} else {
this.$suggestions.hide();
}
},

handleKeydown: function (e) {
Expand Down

0 comments on commit 4dbf57f

Please sign in to comment.