mirror of
https://github.com/Kingsrook/qqq-frontend-material-dashboard.git
synced 2025-07-17 12:50:43 +00:00
CE-1068 - scroll-top-top to show alerts in modals
This commit is contained in:
@ -927,7 +927,7 @@ function EntityForm(props: Props): JSX.Element
|
||||
else
|
||||
{
|
||||
setAlertContent(error.message);
|
||||
HtmlUtils.autoScroll(0);
|
||||
scrollToTopToShowAlert();
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -973,7 +973,7 @@ function EntityForm(props: Props): JSX.Element
|
||||
else
|
||||
{
|
||||
setAlertContent(error.message);
|
||||
HtmlUtils.autoScroll(0);
|
||||
scrollToTopToShowAlert();
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -981,6 +981,22 @@ function EntityForm(props: Props): JSX.Element
|
||||
};
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
*******************************************************************************/
|
||||
function scrollToTopToShowAlert()
|
||||
{
|
||||
if (props.isModal)
|
||||
{
|
||||
document.getElementById("modalTopReference")?.scrollIntoView();
|
||||
}
|
||||
else
|
||||
{
|
||||
HtmlUtils.autoScroll(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
*******************************************************************************/
|
||||
@ -1265,6 +1281,7 @@ function EntityForm(props: Props): JSX.Element
|
||||
return (
|
||||
<Box sx={{position: "absolute", overflowY: "auto", maxHeight: "100%", width: "100%"}}>
|
||||
<Card sx={{my: 5, mx: "auto", p: 6, pb: 0, maxWidth: "1024px"}}>
|
||||
<span id="modalTopReference"></span>
|
||||
{body}
|
||||
</Card>
|
||||
</Box>
|
||||
|
Reference in New Issue
Block a user