Browse Source

Pressing return on a highlighted search result now correctly adds it to the recipe in Firefox.

n1474335 7 years ago
parent
commit
740f3924df
1 changed files with 2 additions and 4 deletions
  1. 2 4
      src/web/OperationsWaiter.mjs

+ 2 - 4
src/web/OperationsWaiter.mjs

@@ -37,7 +37,7 @@ class OperationsWaiter {
     searchOperations(e) {
         let ops, selected;
 
-        if (e.type === "search") { // Search
+        if (e.type === "search" || e.keyCode === 13) { // Search or Return
             e.preventDefault();
             ops = document.querySelectorAll("#search-results li");
             if (ops.length) {
@@ -48,9 +48,7 @@ class OperationsWaiter {
             }
         }
 
-        if (e.keyCode === 13) { // Return
-            e.preventDefault();
-        } else if (e.keyCode === 40) { // Down
+        if (e.keyCode === 40) { // Down
             e.preventDefault();
             ops = document.querySelectorAll("#search-results li");
             if (ops.length) {