diff --git a/public/app/core/components/NavBar/Next/NavBarItem.tsx b/public/app/core/components/NavBar/Next/NavBarItem.tsx
index 8abff2d09df..c0d6490d623 100644
--- a/public/app/core/components/NavBar/Next/NavBarItem.tsx
+++ b/public/app/core/components/NavBar/Next/NavBarItem.tsx
@@ -54,15 +54,14 @@ const NavBarItem = ({
const onNavigate = (item: NavModelItem) => {
const { url, target, onClick } = item;
- if (!url) {
- onClick?.();
- return;
- }
+ onClick?.();
- if (!target && url.startsWith('/')) {
- locationService.push(locationUtil.stripBaseFromUrl(url));
- } else {
- window.open(url, target);
+ if (url) {
+ if (!target && url.startsWith('/')) {
+ locationService.push(locationUtil.stripBaseFromUrl(url));
+ } else {
+ window.open(url, target);
+ }
}
};
diff --git a/public/app/core/components/NavBar/Next/NavBarMenu.tsx b/public/app/core/components/NavBar/Next/NavBarMenu.tsx
index 12c826aa3ca..750f86dd091 100644
--- a/public/app/core/components/NavBar/Next/NavBarMenu.tsx
+++ b/public/app/core/components/NavBar/Next/NavBarMenu.tsx
@@ -7,6 +7,7 @@ import CSSTransition from 'react-transition-group/CSSTransition';
import { useLocalStorage } from 'react-use';
import { GrafanaTheme2, NavModelItem } from '@grafana/data';
+import { reportInteraction } from '@grafana/runtime';
import { CollapsableSection, CustomScrollbar, Icon, IconButton, IconName, useStyles2, useTheme2 } from '@grafana/ui';
import { Branding } from '../../Branding/Branding';
@@ -64,7 +65,14 @@ export function NavBarMenu({ activeItem, isOpen, navItems, onClose, setMenuAnima
variant="secondary"
/>
-
+ {
+ reportInteraction('grafana_navigation_collapsed');
+ onClose();
+ }}
+ />