[v11.0.x] Chore: Fix position for RolePickerMenu being out of bounds (#85892)

Chore: Fix position for RolePickerMenu being out of bounds (#85604)

* Fix position for RolePickerMenu being out of bounds

* adjust the offset of the role picker menu

(cherry picked from commit 85e66d8edb)

Co-authored-by: linoman <2051016+linoman@users.noreply.github.com>
This commit is contained in:
grafana-delivery-bot[bot]
2024-04-10 18:08:58 +02:00
committed by GitHub
co-authored by linoman
parent e5d4ddf59b
commit b88806719d
2 changed files with 5 additions and 4 deletions
@@ -84,10 +84,11 @@ export const RolePicker = ({
let menuToLeft = false;
const distance = window.innerHeight - bottom;
vertical = bottom;
if (distance < MENU_MAX_HEIGHT + 20) {
// Off set to display the role picker menu at the bottom of the screen
// without resorting to scroll the page
vertical = top - MENU_MAX_HEIGHT - 50;
// Limit the top position to 80px to avoid the menu going off the screen
vertical = top < 80 ? 80 : top;
horizontal += right - left + 8;
}
/*
@@ -89,7 +89,7 @@ export const getStyles = (theme: GrafanaTheme2) => ({
}),
menuOptionExpand: css({
position: 'absolute',
right: theme.spacing(1.25),
right: theme.spacing(2.5),
color: theme.colors.text.disabled,
'&:after': {