From a547935f0a4325c5b9530ac69d1d5370f2dab686 Mon Sep 17 00:00:00 2001 From: Robin Scholtes Date: Thu, 20 Apr 2023 20:54:14 +1200 Subject: [PATCH] [#181] resolve favourites cat closing on initial opening mobile UI, update TODO --- src/web/TODO.md | 1 - src/web/waiters/OperationsWaiter.mjs | 14 +++++--------- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/src/web/TODO.md b/src/web/TODO.md index c618a0be..4d3faff1 100644 --- a/src/web/TODO.md +++ b/src/web/TODO.md @@ -5,7 +5,6 @@ ### Mobile UI: #### Operations: -- on click of `input[type="search]`, `favourites` briefly opens and closes. It should remain open until further action. - on mobile, there is almost no visual feedback when adding an operation to the recipe list. Since the recipe list is not visible like on desktop, this is very confusing UX #### General mobile UX: diff --git a/src/web/waiters/OperationsWaiter.mjs b/src/web/waiters/OperationsWaiter.mjs index 22ce82b4..8986c0b1 100755 --- a/src/web/waiters/OperationsWaiter.mjs +++ b/src/web/waiters/OperationsWaiter.mjs @@ -38,10 +38,6 @@ class OperationsWaiter { searchOperations(e) { let ops, selected; - if (e.type === "click" && !e.target.value.length){ - this.openOperationsDropdown(); - } - if (e.type === "keyup"){ const searchResults = document.getElementById("search-results"); @@ -52,10 +48,6 @@ class OperationsWaiter { } } - if (e.type === "keyup" && e.keyCode === 27 ) { // Escape - this.closeOperationsDropdown(); - } - if (e.type === "search" || e.keyCode === 13) { // Search or Return e.preventDefault(); ops = document.querySelectorAll("#search-results li"); @@ -67,7 +59,11 @@ class OperationsWaiter { } } - if (e.keyCode === 40) { // Down + if (e.type === "click" && !e.target.value.length){ + this.openOperationsDropdown(); + } else if (e.keyCode === 27 ) { // Escape + this.closeOperationsDropdown(); + } else if (e.keyCode === 40) { // Down e.preventDefault(); ops = document.querySelectorAll("#search-results li"); if (ops.length) {