scroll nav elements into view when using the keyboard (#50434) (#50479)

(cherry picked from commit 3fa7f72d6c)

Co-authored-by: Ashley Harrison <ashley.harrison@grafana.com>
This commit is contained in:
Grot (@grafanabot)
2022-06-09 09:36:28 +01:00
committed by GitHub
co-authored by Ashley Harrison
parent 1924cfc3c0
commit 8c0decbabd
@@ -173,6 +173,9 @@ export function NavBarItemMenuTrigger(props: NavBarItemMenuTriggerProps): ReactE
setMenuIdOpen(item.id);
state.open();
}
e.target.scrollIntoView({
block: 'nearest',
});
},
onBlurWithin: (e) => {
if (e.target?.getAttribute('role') === 'menuitem' && !overlayRef.current?.contains(e.relatedTarget)) {