diff --git a/services/web/frontend/js/features/project-list/components/new-project-button/modal-content-new-project-form.tsx b/services/web/frontend/js/features/project-list/components/new-project-button/modal-content-new-project-form.tsx index 415fed359f..bc7dbca75d 100644 --- a/services/web/frontend/js/features/project-list/components/new-project-button/modal-content-new-project-form.tsx +++ b/services/web/frontend/js/features/project-list/components/new-project-button/modal-content-new-project-form.tsx @@ -6,6 +6,7 @@ import { getUserFacingMessage, postJSON, } from '../../../../infrastructure/fetch-json' +import { useRefWithAutoFocus } from '../../../../shared/hooks/use-ref-with-auto-focus' type NewProjectData = { project_id: string @@ -25,6 +26,7 @@ type Props = { function ModalContentNewProjectForm({ onCancel, template = 'none' }: Props) { const { t } = useTranslation() + const { autoFocusedRef } = useRefWithAutoFocus() const [projectName, setProjectName] = useState('') const { isLoading, isError, error, runAsync } = useAsync() @@ -62,8 +64,10 @@ function ModalContentNewProjectForm({ onCancel, template = 'none' }: Props) { {isError && ( {getUserFacingMessage(error)} )} - () { + const autoFocusedRef = useRef(null) useEffect(() => { if (autoFocusedRef.current) {