diff --git a/editor.planx.uk/src/@planx/components/List/Public/index.tsx b/editor.planx.uk/src/@planx/components/List/Public/index.tsx index 44117493dc..5a7ce22cd9 100644 --- a/editor.planx.uk/src/@planx/components/List/Public/index.tsx +++ b/editor.planx.uk/src/@planx/components/List/Public/index.tsx @@ -9,7 +9,7 @@ import TableCell from "@mui/material/TableCell"; import TableRow from "@mui/material/TableRow"; import Typography from "@mui/material/Typography"; import { PublicProps } from "@planx/components/ui"; -import React from "react"; +import React, { useEffect, useRef } from "react"; import { FONT_WEIGHT_SEMI_BOLD } from "theme"; import ErrorWrapper from "ui/shared/ErrorWrapper"; import InputRow from "ui/shared/InputRow"; @@ -67,12 +67,15 @@ const ActiveListCard: React.FC<{ }> = ({ index: i }) => { const { schema, saveItem, cancelEditItem, errors, isPageComponent } = useListContext(); - + + const ref = useRef(null); + useEffect(() => ref.current?.scrollIntoView({ behavior: "smooth" }), []); + return ( - + {schema.type} {!isPageComponent && ` ${i + 1}`}