From 6bc1bf9549386e6e90f7b394cda228641f62c9cb Mon Sep 17 00:00:00 2001 From: Muhammad Ali Date: Fri, 31 Jan 2025 18:00:09 +0500 Subject: [PATCH] Scroll to selected page --- .../Navigation/NavigationElement/NavigationElement.tsx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/static/client/components/Navigation/NavigationElement/NavigationElement.tsx b/static/client/components/Navigation/NavigationElement/NavigationElement.tsx index 58f8218e..2b5c042b 100644 --- a/static/client/components/Navigation/NavigationElement/NavigationElement.tsx +++ b/static/client/components/Navigation/NavigationElement/NavigationElement.tsx @@ -50,6 +50,12 @@ const NavigationElement = ({ activePageName, page, project, onSelect }: INavigat } }, [page?.children]); + useEffect(() => { + if (activePageName === page.name) { + document.querySelector('li[aria-selected="true"]')?.scrollIntoView({ behavior: "smooth", block: "center" }); + } + }, [activePageName, page.name]); + return (