mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
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
This commit is contained in:
parent
9c42826c30
commit
5561ace467
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user