Blazor - InvokeVoidAsync , does not call JS function if the function is called from outside the component

Viewed 17

I have created a Blazor subcomponent. That wraps a richtext control.

When I call the 'DoFocus' from a button that is on that same control it works.

When I call the 'DoFocus' from the parent control , triggered by a keyboard shortcut. I see the InvokeVoidAsync is called. But the javascript code is not.

Also calling the DoFocus with InvokeAsync does not do the trick.

public void DoFocus()
{
    Console.WriteLine("InputRichText - Do Focus - Start - csharp - alert {0}", Id);

    JSRuntime.InvokeVoidAsync("CKEditorInterop.alert", Id);

    Console.WriteLine("InputRichText - Do Focus - Finish - csharp - alert - {0}", Id);
}
0 Answers
Related