using Microsoft.JSInterop; using System.Threading.Tasks; namespace cwebplusApp.Shared.Services { // This class is only needed to work around a bug in MatDialogService.AskAsync. // It removes a class from body, which is erroneously left there after a call to AskAsync. // See https://github.com/SamProf/MatBlazor/issues/829 . REMOVE AS SOON AS THE BUG IS FIXED! public class ScrollLockRemover { private readonly IJSRuntime jsRuntime; public ScrollLockRemover(IJSRuntime _jsRuntime) { jsRuntime = _jsRuntime; } public async Task removeScrollLockAsync() { var reference = DotNetObjectReference.Create(this); await jsRuntime.InvokeVoidAsync("RemoveScrollLock", reference); } } }