From ec80a3847b9d704e7a751ff79701b9bc27871d56 Mon Sep 17 00:00:00 2001 From: Nolan Lawson Date: Fri, 30 Mar 2018 17:34:10 -0700 Subject: [PATCH] clicking Esc clears autosuggestions --- routes/_components/compose/ComposeInput.html | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/routes/_components/compose/ComposeInput.html b/routes/_components/compose/ComposeInput.html index 90de493d..2d4e0a20 100644 --- a/routes/_components/compose/ComposeInput.html +++ b/routes/_components/compose/ComposeInput.html @@ -112,6 +112,9 @@ case 40: // down this.incrementAutosuggestSelected(1, e) break + case 27: // escape + this.clearAutosuggestions(e) + break default: } }, @@ -127,6 +130,7 @@ /* no await */ clickSelectedAutosuggestionEmoji(this.get('realm')) } event.preventDefault() + event.stopPropagation() }, incrementAutosuggestSelected(increment, event) { let autosuggestionShown = this.store.get('composeAutosuggestionShown') @@ -143,6 +147,19 @@ } this.store.set({composeAutosuggestionSelected: selected}) event.preventDefault() + event.stopPropagation() + }, + clearAutosuggestions(event) { + let autosuggestionShown = this.store.get('composeAutosuggestionShown') + if (!autosuggestionShown) { + return + } + this.store.set({ + composeAutosuggestionSearchResults: [], + composeAutosuggestionSelected: 0 + }) + event.preventDefault() + event.stopPropagation() } }, store: () => store,