Add scroll to top when switching between steps (#315)

This commit is contained in:
Leendert de Borst
2024-10-22 21:18:26 +02:00
parent f6c9000bec
commit 88e5142049
2 changed files with 13 additions and 1 deletions

View File

@@ -135,7 +135,7 @@
/// <summary>
/// Navigates to the next step in the setup process.
/// </summary>
private void GoNext()
private async Task GoNext()
{
_currentStep = _currentStep switch
{
@@ -145,6 +145,9 @@
SetupStep.Password => SetupStep.Creating,
_ => _currentStep
};
await JsInteropService.ScrollToTop();
StateHasChanged();
}
/// <summary>

View File

@@ -228,6 +228,15 @@ public sealed class JsInteropService(IJSRuntime jsRuntime)
}
}
/// <summary>
/// Scrolls to the top of the page.
/// </summary>
/// <returns>Task.</returns>
public async Task ScrollToTop()
{
await jsRuntime.InvokeVoidAsync("window.scrollTo", 0, 0);
}
/// <summary>
/// Represents the result of a WebAuthn get credential operation.
/// </summary>