Commit 9bb516e4 by Andrej Ocenas Committed by GitHub

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

parent 65b0365a
......@@ -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);
}
}}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment