FIX: fix regressions introduced in ae16b0a (#14967)

FIX: fix regressions introduced in ae16b0a (#14967)

  • ensures arrow up/down doesn’t also apply to textarea while autocomplete is opened
  • ensures esc is closing autocomplete and also not closing composer while autocomplete is opened
diff --git a/app/assets/javascripts/discourse/app/lib/autocomplete.js b/app/assets/javascripts/discourse/app/lib/autocomplete.js
index 30d4aa5..5645050 100644
--- a/app/assets/javascripts/discourse/app/lib/autocomplete.js
+++ b/app/assets/javascripts/discourse/app/lib/autocomplete.js
@@ -558,6 +558,8 @@ export default function (options) {
     if (e.which === keys.esc) {
       if (div !== null) {
         closeAutocomplete();
+        e.preventDefault();
+        e.stopImmediatePropagation();
         return false;
       }
       return true;
@@ -605,6 +607,7 @@ export default function (options) {
             selectedOption = 0;
           }
           markSelected();
+          e.preventDefault();
           return false;
         case keys.downArrow:
           total = autocompleteOptions.length;
@@ -616,6 +619,7 @@ export default function (options) {
             selectedOption = 0;
           }
           markSelected();
+          e.preventDefault();
           return false;
         case keys.backSpace:
           autocompleteOptions = null;

GitHub sha: 2167d4d8907413ba2475ff0a1cacb1c58a98f75b

This commit appears in #14967 which was approved by davidtaylorhq. It was merged by jjaffeux.