diff --git a/Oqtane.Client/Modules/Admin/Site/Index.razor b/Oqtane.Client/Modules/Admin/Site/Index.razor index 904e19c7..26571c91 100644 --- a/Oqtane.Client/Modules/Admin/Site/Index.razor +++ b/Oqtane.Client/Modules/Admin/Site/Index.razor @@ -624,8 +624,9 @@ else { AddModuleMessage(Localizer["Success.Settings.SaveSite"], MessageType.Success); - await interop.ScrollTo(0, 0, "smooth"); - } + // scroll to top of page so user can see messages + await ScrollToTop(); + } } } else @@ -693,9 +694,10 @@ await NotificationService.AddNotificationAsync(new Notification(PageState.Site.SiteId, PageState.User, PageState.Site.Name + " SMTP Configuration Test", "SMTP Server Is Configured Correctly.")); AddModuleMessage(Localizer["Info.Smtp.SaveSettings"], MessageType.Info); - var interop = new Interop(JSRuntime); - await interop.ScrollTo(0, 0, "smooth"); - } + + // scroll to top of page so user can see messages + await ScrollToTop(); + } catch (Exception ex) { await logger.LogError(ex, "Error Testing SMTP Configuration"); diff --git a/Oqtane.Client/Modules/Admin/UserProfile/Index.razor b/Oqtane.Client/Modules/Admin/UserProfile/Index.razor index 4c1c22b9..5cfe6916 100644 --- a/Oqtane.Client/Modules/Admin/UserProfile/Index.razor +++ b/Oqtane.Client/Modules/Admin/UserProfile/Index.razor @@ -356,9 +356,6 @@ else AddModuleMessage(Localizer["Success.Profile.Update"], MessageType.Success); StateHasChanged(); - - var interop = new Interop(JSRuntime); - await interop.ScrollTo(0, 0, "smooth"); } else { @@ -374,6 +371,9 @@ else { AddModuleMessage(Localizer["Message.Required.ProfileInfo"], MessageType.Warning); } + + // scroll to top of page so user can see messages + await ScrollToTop(); } catch (Exception ex) { diff --git a/Oqtane.Client/Modules/ModuleBase.cs b/Oqtane.Client/Modules/ModuleBase.cs index 01ad8848..1fecab4e 100644 --- a/Oqtane.Client/Modules/ModuleBase.cs +++ b/Oqtane.Client/Modules/ModuleBase.cs @@ -291,6 +291,12 @@ namespace Oqtane.Modules } } + public async Task ScrollToTop() + { + var interop = new Interop(JSRuntime); + await interop.ScrollTo(0, 0, "smooth"); + } + // logging methods public async Task Log(Alias alias, LogLevel level, string function, Exception exception, string message, params object[] args) {