diff --git a/front/src/applications/stdcm/components/StdcmWarningBox.tsx b/front/src/applications/stdcm/components/StdcmWarningBox.tsx index 46364b0f77b..9fcfa9ba0df 100644 --- a/front/src/applications/stdcm/components/StdcmWarningBox.tsx +++ b/front/src/applications/stdcm/components/StdcmWarningBox.tsx @@ -1,3 +1,5 @@ +import { useEffect, useRef } from 'react'; + import { Button } from '@osrd-project/ui-core'; import { Alert } from '@osrd-project/ui-icons'; import cx from 'classnames'; @@ -25,8 +27,16 @@ const StdcmWarningBox = ({ removeDestinationArrivalTime, }: StdcmWarningBoxProps) => { const { t } = useTranslation('stdcm'); + const ref = useRef(null); + + useEffect(() => { + if (errorType && errorType !== StdcmConfigErrorTypes.MISSING_LOCATION && ref.current) { + ref.current.scrollIntoView({ behavior: 'smooth' }); + } + }, [errorType]); + return ( -
+