diff --git a/public/app/core/components/AppChrome/AppChrome.tsx b/public/app/core/components/AppChrome/AppChrome.tsx
index e85295e4660..ad875efbb3e 100644
--- a/public/app/core/components/AppChrome/AppChrome.tsx
+++ b/public/app/core/components/AppChrome/AppChrome.tsx
@@ -15,6 +15,7 @@ import { KioskMode } from 'app/types';
import { AppChromeMenu } from './AppChromeMenu';
import { DOCKED_LOCAL_STORAGE_KEY, DOCKED_MENU_OPEN_LOCAL_STORAGE_KEY } from './AppChromeService';
import { MegaMenu, MENU_WIDTH } from './MegaMenu/MegaMenu';
+import { useMegaMenuFocusHelper } from './MegaMenu/utils';
import { NavToolbar } from './NavToolbar/NavToolbar';
import { ReturnToPrevious } from './ReturnToPrevious/ReturnToPrevious';
import { SingleTopBar } from './TopBar/SingleTopBar';
@@ -50,6 +51,7 @@ export function AppChrome({ children }: Props) {
}
},
});
+ useMegaMenuFocusHelper(state.megaMenuOpen, state.megaMenuDocked);
const contentClass = cx({
[styles.content]: true,
diff --git a/public/app/core/components/AppChrome/AppChromeMenu.tsx b/public/app/core/components/AppChrome/AppChromeMenu.tsx
index cf02b6a7c48..e649fdb12b1 100644
--- a/public/app/core/components/AppChrome/AppChromeMenu.tsx
+++ b/public/app/core/components/AppChrome/AppChromeMenu.tsx
@@ -58,9 +58,13 @@ export function AppChromeMenu({}: Props) {
classNames={animationStyles.overlay}
timeout={{ enter: animationSpeed, exit: 0 }}
>
-
-
-
+ <>
+ {isOpen && (
+
+
+
+ )}
+ >
{
- document.getElementById(state.megaMenuDocked ? 'mega-menu-toggle' : 'dock-menu-button')?.focus();
- });
+ if (!config.featureToggles.singleTopNav) {
+ setTimeout(() => {
+ document.getElementById(state.megaMenuDocked ? MEGA_MENU_TOGGLE_ID : DOCK_MENU_BUTTON_ID)?.focus();
+ });
+ }
};
const isPinned = useCallback(
diff --git a/public/app/core/components/AppChrome/MegaMenu/MegaMenuHeader.tsx b/public/app/core/components/AppChrome/MegaMenu/MegaMenuHeader.tsx
index 3fb7d247226..92062891de7 100644
--- a/public/app/core/components/AppChrome/MegaMenu/MegaMenuHeader.tsx
+++ b/public/app/core/components/AppChrome/MegaMenu/MegaMenuHeader.tsx
@@ -15,6 +15,9 @@ export interface Props {
onClose: () => void;
}
+export const DOCK_MENU_BUTTON_ID = 'dock-menu-button';
+export const MEGA_MENU_HEADER_TOGGLE_ID = 'mega-menu-header-toggle';
+
export function MegaMenuHeader({ handleMegaMenu, handleDockedMenu, onClose }: Props) {
const theme = useTheme2();
const { chrome } = useGrafana();
@@ -24,13 +27,18 @@ export function MegaMenuHeader({ handleMegaMenu, handleDockedMenu, onClose }: Pr
return (
-
+