From 725ad98fcf6c83f1fdd34e0ddb4d764f986e5549 Mon Sep 17 00:00:00 2001 From: Martin Dragnev Date: Tue, 16 Jan 2024 15:46:42 +0200 Subject: [PATCH] Add a check to disable prevent scroll logic for blazor server --- .../Navigation/BrowserLayout.razor | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/browser/IgBlazorSamples.Core/Navigation/BrowserLayout.razor b/browser/IgBlazorSamples.Core/Navigation/BrowserLayout.razor index 481da8e19d..5384b243b3 100644 --- a/browser/IgBlazorSamples.Core/Navigation/BrowserLayout.razor +++ b/browser/IgBlazorSamples.Core/Navigation/BrowserLayout.razor @@ -82,13 +82,18 @@ protected override async Task OnInitializedAsync() @* await SB.CheckUIAsync(NavManager.Uri); StateHasChanged(); *@ await Task.Delay(1); - await JSRuntime.InvokeVoidAsync("attachPreventScroll"); + if (!NavManager.Uri.Contains("/blazor-server")) + { + await JSRuntime.InvokeVoidAsync("attachPreventScroll"); + } } public async ValueTask DisposeAsync() { - await JSRuntime.InvokeVoidAsync("removePreventScroll"); - + if (!NavManager.Uri.Contains("/blazor-server")) + { + await JSRuntime.InvokeVoidAsync("removePreventScroll"); + } } protected bool IsSampleWithNavigation() {