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
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -39,7 +39,7 @@ export const ContextMenu = React.memo(
setPositionStyles({ setPositionStyles({
position: 'fixed', position: 'fixed',
left: collisions.right ? x - rect.width - OFFSET : x - OFFSET, 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]); }, [x, y]);