mirror of
https://github.com/grafana/grafana.git
synced 2024-11-22 08:56:43 -06:00
Grafana-ui: Allow context menu items to be open in new tab (#30141)
This commit is contained in:
parent
65b0365aeb
commit
9bb516e4e5
@ -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…
Reference in New Issue
Block a user