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
This commit is contained in:
linoman 2024-04-10 09:51:50 -06:00 committed by GitHub
parent 483dc02b68
commit 85e66d8edb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 4 deletions

View File

@ -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;
}
/*

View File

@ -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': {