FIX: allows paste from context menu to work (#14061)

FIX: allows paste from context menu to work (#14061)

  • uses keyDown for Enter event
  • input for other keys and pasting
diff --git a/app/assets/javascripts/discourse/app/widgets/search-menu-controls.js b/app/assets/javascripts/discourse/app/widgets/search-menu-controls.js
index dc329df..b711790 100644
--- a/app/assets/javascripts/discourse/app/widgets/search-menu-controls.js
+++ b/app/assets/javascripts/discourse/app/widgets/search-menu-controls.js
@@ -7,7 +7,7 @@ import { searchContextDescription } from "discourse/lib/search";
 createWidget("search-term", {
   tagName: "input",
   buildId: () => "search-term",
-  buildKey: () => `search-term`,
+  buildKey: () => "search-term",
 
   defaultState() {
     return { afterAutocomplete: false };
@@ -23,12 +23,15 @@ createWidget("search-term", {
     };
   },
 
-  keyUp(e) {
-    if (e.which === 13 && !this.state.afterAutocomplete) {
+  keyDown(e) {
+    if (e.key === "Enter" && !this.state.afterAutocomplete) {
       return this.sendWidgetAction("fullSearch");
     }
+  },
 
+  input(e) {
     const val = this.attrs.value;
+
     // remove zero-width chars
     const newVal = e.target.value.replace(/[\u200B-\u200D\uFEFF]/, "");
 

GitHub sha: c65822d47b9a720afec99e58845a16e380c24321

This commit appears in #14061 which was approved by techAPJ. It was merged by techAPJ.