GrafanaUI: Make sure ContextMenu does not get cut off at the top (#77435)

This commit is contained in:
Joao Silva
2023-11-01 10:07:08 +00:00
committed by GitHub
parent 6c6c54637f
commit f42bb86667

View File

@@ -39,7 +39,7 @@ export const ContextMenu = React.memo(
setPositionStyles({
position: 'fixed',
left: collisions.right ? x - rect.width - OFFSET : x - OFFSET,
top: collisions.bottom ? y - rect.height - OFFSET : y + OFFSET,
top: Math.max(0, collisions.bottom ? y - rect.height - OFFSET : y + OFFSET),
});
}
}, [x, y]);