CE-1068 - scroll-top-top to show alerts in modals

This commit is contained in:
2024-05-01 15:35:13 -05:00
parent e0f689544d
commit 1bf1f09e9d

View File

@ -927,7 +927,7 @@ function EntityForm(props: Props): JSX.Element
else else
{ {
setAlertContent(error.message); setAlertContent(error.message);
HtmlUtils.autoScroll(0); scrollToTopToShowAlert();
} }
}); });
} }
@ -973,7 +973,7 @@ function EntityForm(props: Props): JSX.Element
else else
{ {
setAlertContent(error.message); 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 ( return (
<Box sx={{position: "absolute", overflowY: "auto", maxHeight: "100%", width: "100%"}}> <Box sx={{position: "absolute", overflowY: "auto", maxHeight: "100%", width: "100%"}}>
<Card sx={{my: 5, mx: "auto", p: 6, pb: 0, maxWidth: "1024px"}}> <Card sx={{my: 5, mx: "auto", p: 6, pb: 0, maxWidth: "1024px"}}>
<span id="modalTopReference"></span>
{body} {body}
</Card> </Card>
</Box> </Box>