Grafana-ui: Allow context menu items to be open in new tab (#30141)

pull/30283/head
Andrej Ocenas 5 years ago committed by GitHub
parent 65b0365aeb
commit 9bb516e4e5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      packages/grafana-ui/src/components/Menu/Menu.tsx

@ -120,7 +120,14 @@ const MenuItemComponent: React.FC<MenuItemProps> = React.memo(({ url, icon, labe
target={target}
className={cx(className, styles.link)}
onClick={e => {
// We can have both url and onClick and we want to allow user to open the link in new tab/window
const isSpecialKeyPressed = e.ctrlKey || e.metaKey || e.shiftKey;
if (isSpecialKeyPressed && url) {
return;
}
if (onClick) {
e.preventDefault();
onClick(e);
}
}}

Loading…
Cancel
Save