summaryrefslogtreecommitdiffstats
path: root/src/components/SearchForm
diff options
context:
space:
mode:
authorArmand Philippot <git@armandphilippot.com>2022-01-14 11:42:34 +0100
committerArmand Philippot <git@armandphilippot.com>2022-01-14 11:42:34 +0100
commit88478d6b991de50582a6ef85781eed5f56d68dbb (patch)
tree0c00c3ad9b1ad1ecad0fbda1740e37dce360735b /src/components/SearchForm
parent010e2e68568b3894fcaefc1f7c735b810a29a5c4 (diff)
chore(toolbar): close modals on click/focus outside
Diffstat (limited to 'src/components/SearchForm')
-rw-r--r--src/components/SearchForm/SearchForm.tsx4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/components/SearchForm/SearchForm.tsx b/src/components/SearchForm/SearchForm.tsx
index c1a7ca7..cefda85 100644
--- a/src/components/SearchForm/SearchForm.tsx
+++ b/src/components/SearchForm/SearchForm.tsx
@@ -13,10 +13,10 @@ const SearchForm = ({ isOpened }: { isOpened: boolean }) => {
useEffect(() => {
setTimeout(() => {
- if (inputRef.current) {
+ if (isOpened && inputRef.current) {
inputRef.current.focus();
}
- }, 800);
+ }, 400);
}, [isOpened]);
const launchSearch = (e: FormEvent) => {