aboutsummaryrefslogtreecommitdiffstats
path: root/apps/web
diff options
context:
space:
mode:
authorMohamed Bassem <me@mbassem.com>2024-10-27 08:37:26 +0000
committerMohamed Bassem <me@mbassem.com>2024-10-27 08:37:26 +0000
commit9d6d70d21f86942732870c5aca536d43c1aa1c97 (patch)
tree39eb957687e80d75df36659f7995dbeacd6afa9a /apps/web
parentc0b0691144164aebd9173f92ba7972a17b5d605f (diff)
downloadkarakeep-9d6d70d21f86942732870c5aca536d43c1aa1c97.tar.zst
fix: Fix search input escape listener to only work when the input is in focus
Diffstat (limited to 'apps/web')
-rw-r--r--apps/web/components/dashboard/search/SearchInput.tsx6
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 = "";