diff --git a/resources/scripts/components/dashboard/search/SearchModal.tsx b/resources/scripts/components/dashboard/search/SearchModal.tsx
index 75eff1bfd..9bd871ce5 100644
--- a/resources/scripts/components/dashboard/search/SearchModal.tsx
+++ b/resources/scripts/components/dashboard/search/SearchModal.tsx
@@ -63,22 +63,24 @@ export default ({ ...props }: Props) => {
console.error(error);
addError({ key: 'search', message: httpErrorToHuman(error) });
})
- .then(() => setLoading(false));
+ .then(() => setLoading(false))
+ .then(() => ref.current?.focus());
}, 500);
useEffect(() => {
if (props.visible) {
- setTimeout(() => ref.current?.focus(), 250);
+ if (ref.current) ref.current.focus();
}
}, [ props.visible ]);
+ // Formik does not support an innerRef on custom components.
+ const InputWithRef = (props: any) => ;
+
return (
@@ -95,7 +97,7 @@ export default ({ ...props }: Props) => {
>
-
+