From 1bf1f09e9dad6c87f492a3fb53ede52cf6e49536 Mon Sep 17 00:00:00 2001 From: Darin Kelkhoff Date: Wed, 1 May 2024 15:35:13 -0500 Subject: [PATCH] CE-1068 - scroll-top-top to show alerts in modals --- src/qqq/components/forms/EntityForm.tsx | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/src/qqq/components/forms/EntityForm.tsx b/src/qqq/components/forms/EntityForm.tsx index 2199ff9..bd01e2a 100644 --- a/src/qqq/components/forms/EntityForm.tsx +++ b/src/qqq/components/forms/EntityForm.tsx @@ -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 ( + {body}