pages/search: searchbox: clear on Esc

This commit is contained in:
He4eT 2024-01-22 03:20:33 +01:00
commit 9c3e5593e6

View file

@ -45,8 +45,15 @@ export const attachInputHandlers = (store) => {
})
if (e.key === 'Escape') {
const resetSearch = () => {
searchBox.value = ''
store.actions.updateQuery('')
}
document.activeElement === searchBox
? searchBox.value === ''
? store.actions.closeCurrentTab()
: resetSearch()
: searchBox.focus()
}
})