From 1c34cc8b911bd9b1fe8699ba39045804fdb9e27c Mon Sep 17 00:00:00 2001 From: Ashley Harrison Date: Mon, 4 Apr 2022 16:51:24 +0100 Subject: [PATCH] Navigation: Put expand toggle at beginning of tab order (#47268) * Put toggle at beginning of tab order * create NavBarToggle * move margin into the common component * lint fixes --- .../components/NavBar/Next/NavBarMenu.tsx | 12 +++++- .../components/NavBar/Next/NavBarNext.tsx | 40 +++++------------- .../components/NavBar/Next/NavBarToggle.tsx | 41 +++++++++++++++++++ 3 files changed, 62 insertions(+), 31 deletions(-) create mode 100644 public/app/core/components/NavBar/Next/NavBarToggle.tsx diff --git a/public/app/core/components/NavBar/Next/NavBarMenu.tsx b/public/app/core/components/NavBar/Next/NavBarMenu.tsx index 63232cc6596..e5c17517721 100644 --- a/public/app/core/components/NavBar/Next/NavBarMenu.tsx +++ b/public/app/core/components/NavBar/Next/NavBarMenu.tsx @@ -8,21 +8,23 @@ import { css, cx } from '@emotion/css'; import { NavBarMenuItem } from './NavBarMenuItem'; import { NavBarItemWithoutMenu } from './NavBarItemWithoutMenu'; import { isMatchOrChildMatch } from '../utils'; +import { NavBarToggle } from './NavBarToggle'; export interface Props { activeItem?: NavModelItem; + isOpen: boolean; navItems: NavModelItem[]; onClose: () => void; } -export function NavBarMenu({ activeItem, navItems, onClose }: Props) { +export function NavBarMenu({ activeItem, isOpen, navItems, onClose }: Props) { const styles = useStyles2(getStyles); const ref = useRef(null); const { dialogProps } = useDialog({}, ref); const { overlayProps } = useOverlay( { isDismissable: true, - isOpen: true, + isOpen, onClose, }, ref @@ -32,6 +34,7 @@ export function NavBarMenu({ activeItem, navItems, onClose }: Props) {
+ setMenuOpen(!menuOpen)} + /> +