diff options
| author | Mohamed Bassem <me@mbassem.com> | 2024-10-27 08:37:26 +0000 |
|---|---|---|
| committer | Mohamed Bassem <me@mbassem.com> | 2024-10-27 08:37:26 +0000 |
| commit | 9d6d70d21f86942732870c5aca536d43c1aa1c97 (patch) | |
| tree | 39eb957687e80d75df36659f7995dbeacd6afa9a /apps/web/components/dashboard | |
| parent | c0b0691144164aebd9173f92ba7972a17b5d605f (diff) | |
| download | karakeep-9d6d70d21f86942732870c5aca536d43c1aa1c97.tar.zst | |
fix: Fix search input escape listener to only work when the input is in focus
Diffstat (limited to 'apps/web/components/dashboard')
| -rw-r--r-- | apps/web/components/dashboard/search/SearchInput.tsx | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/apps/web/components/dashboard/search/SearchInput.tsx b/apps/web/components/dashboard/search/SearchInput.tsx index 0f752fde..a7caf44e 100644 --- a/apps/web/components/dashboard/search/SearchInput.tsx +++ b/apps/web/components/dashboard/search/SearchInput.tsx @@ -20,7 +20,11 @@ function useFocusSearchOnKeyPress( const length = inputRef.current.value.length; inputRef.current.setSelectionRange(length, length); } - if (e.code === "Escape") { + if ( + e.code === "Escape" && + e.target == inputRef.current && + inputRef.current.value !== "" + ) { e.preventDefault(); inputRef.current.blur(); inputRef.current.value = ""; |
