diff --git a/pages/search/modules/inputHandlers.js b/pages/search/modules/inputHandlers.js index 315d3c3..28c2c45 100644 --- a/pages/search/modules/inputHandlers.js +++ b/pages/search/modules/inputHandlers.js @@ -45,8 +45,15 @@ export const attachInputHandlers = (store) => { }) if (e.key === 'Escape') { + const resetSearch = () => { + searchBox.value = '' + store.actions.updateQuery('') + } + document.activeElement === searchBox - ? store.actions.closeCurrentTab() + ? searchBox.value === '' + ? store.actions.closeCurrentTab() + : resetSearch() : searchBox.focus() } })