mirror of
https://github.com/He4eT/tabswitcher.git
synced 2026-05-04 17:07:23 +00:00
pages/search: searchbox: clear on Esc
This commit is contained in:
parent
77561ae793
commit
9c3e5593e6
1 changed files with 8 additions and 1 deletions
|
|
@ -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()
|
||||
}
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue