housekeeping updates #7

Merged
nseguin merged 15 commits from dev into main 2024-03-29 14:10:45 -05:00
2 changed files with 15 additions and 2 deletions
Showing only changes of commit 57e3fb1a7e - Show all commits

View file

@ -1,14 +1,21 @@
@inject IJSRuntime JSRuntime
@code {
[Parameter]
public Func<ElementReference> GetControl { get; set; }
public Func<ElementReference>? GetControl { get; set; }
protected override async Task OnAfterRenderAsync(bool firstRender)
{
if (GetControl is null)
{
throw new ArgumentNullException(nameof(GetControl));
}
if (firstRender)
{
await JSRuntime.InvokeVoidAsync("App.scrollIntoView", GetControl(), true);
}
}
}

View file

@ -1,9 +1,15 @@
var App = App || {};
const App = App || {};
App.setFocus = function (element) {
element.focus();
}
App.scrollIntoView = function (element, args) {
if (element === undefined) {
console.error('Element is undefined');
} else if (element === null) {
console.error('Element is null');
}
element.scrollIntoView(args);
}