If you have worked with other JS front-end before, you might have used a setTimeout(someFunction, 0) workaround to let some rendering happen before your function is executed. In Blazor, there are similar needs to wait for something to render before you can actually interact with its DOM - and focus requires JS interop, there is no "native" way to do it.
So, you need to wait for the new markup to render (be that a window or something else) and a simple await Task.Delay(30) usually does the trick.
Below is a small example that showcases this, and you may want to review (and it it is to your liking, Vote for and Follow) this request.
Even if I go into dev tools after the page has rendered and try to do .focus() on the text box it doesn't take focus.
Is there something I have to do special to set focus on a Telerik Textbox?
answered on 25 Sep 2020, 03:38 PM
There is nothing special for the TelerikTextbox, and the idea I can offer right now is to increase the timeout, try 50 or 100 milliseconds. If that does not help, I suggest you open a support ticket and send me a modified version of my snippet (please keep it runnable) that demonstrates the problem so I can have a look and avoid guessing.
Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.