Radzen focus RadzenAutocomplete

Hi,

I'm currently trying to make a radzen autocomplete focus after render but it doesn't seem to be working.

this is my code at the moment.

<RadzenAutoComplete name="searchbar" id="searchbar" Data="@AllItemNo" @bind-Value="@input" FilterCaseSensitivity="FilterCaseSensitivity.CaseInsensitive" FilterOperator="StringFilterOperator.StartsWith" @onkeyup="KeyboardTrigger" @ref=@barcodeInput />
 RadzenAutoComplete barcodeInput;
protected override async Task OnAfterRenderAsync(bool firstRender)
{
    if (firstRender)
    {
        await barcodeInput.Element.FocusAsync();
    }
}

You can try also alternative approach:

If I change my autocomplete to a textbox it works.
it doesn't work for autocomplete.

The TextBox will render simple input while the AutoComplete is a bit more complex:

UPDATE: We've decided to add FocusAsync() method:

okay so is there a way to focus an autocomplete or is it to complex to focus?

I've updated my reply, the new method will be part of our next update later this week.

ok thank you so much

I just want to throw in my 2 cents. I was having this issue with an autocomplete in a dialog. Setting the delay to 1 second or more is all that worked until I saw a post about making sure to set AutoFocusFirstElement= false in the DialogOptions before calling the dialog. Works perfect now. It’s always the little things. :wink: