From 2eab05a147cf16aad1ac40aeaa4d3470e6cdec15 Mon Sep 17 00:00:00 2001 From: Eitan Elbaz Date: Tue, 27 Jun 2023 18:01:39 +0100 Subject: [PATCH] conditionally call scroll into view --- src/components/Step/Step.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/Step/Step.tsx b/src/components/Step/Step.tsx index d82cc43..639a144 100644 --- a/src/components/Step/Step.tsx +++ b/src/components/Step/Step.tsx @@ -64,7 +64,7 @@ const Step = React.memo( setAnchorBoundaries((anchorElement ?? element).getBoundingClientRect()); }, [element, anchorElement]); const scrollToElement = useCallback(() => { - element.scrollIntoView(scrollIntoViewOptions); + element?.scrollIntoView?.(scrollIntoViewOptions); adjustBoundaries(); }, [adjustBoundaries, element, scrollIntoViewOptions]); useEffect(() => {