From 2db42e970dbe65d50d14b208e14cd601feb27bba Mon Sep 17 00:00:00 2001 From: Guo Xiang Tan Date: Sat, 16 Apr 2016 23:53:24 +0800 Subject: [PATCH] FIX: Autocomplete retriggering when term is blank on keyup. --- app/assets/javascripts/discourse/lib/autocomplete.js.es6 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/discourse/lib/autocomplete.js.es6 b/app/assets/javascripts/discourse/lib/autocomplete.js.es6 index 0d158734bd5..a142947da65 100644 --- a/app/assets/javascripts/discourse/lib/autocomplete.js.es6 +++ b/app/assets/javascripts/discourse/lib/autocomplete.js.es6 @@ -322,7 +322,8 @@ export default function(options) { } }; - $(this).on('keyup.autocomplete', function() { + $(this).on('keyup.autocomplete', function(e) { + if ([keys.esc, keys.enter].indexOf(e.which) !== -1) return true; var caretPosition = Discourse.Utilities.caretPosition(me[0]);