From 5561ace46750dd25467736375481ca143b693288 Mon Sep 17 00:00:00 2001 From: Ashley Harrison Date: Thu, 22 Feb 2024 11:04:18 +0000 Subject: [PATCH] Navigation: Scroll the active menu item into view when menu is an overlay (#83212) scroll the active menu item into view even when not docked --- .../app/core/components/AppChrome/MegaMenu/MegaMenuItem.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/app/core/components/AppChrome/MegaMenu/MegaMenuItem.tsx b/public/app/core/components/AppChrome/MegaMenu/MegaMenuItem.tsx index d91514f8787..528c0c9a04f 100644 --- a/public/app/core/components/AppChrome/MegaMenu/MegaMenuItem.tsx +++ b/public/app/core/components/AppChrome/MegaMenu/MegaMenuItem.tsx @@ -48,12 +48,12 @@ export function MegaMenuItem({ link, activeItem, level = 0, onClick }: Props) { // scroll active element into center if it's offscreen useEffect(() => { - if (menuIsDocked && isActive && item.current && isElementOffscreen(item.current)) { + if (isActive && item.current && isElementOffscreen(item.current)) { item.current.scrollIntoView({ block: 'center', }); } - }, [isActive, menuIsDocked]); + }, [isActive]); if (!link.url) { return null;