Skip to content

Autocomplete: input getting validated after OnChanged-event fired #581

Open
@timmo-waller

Description

@timmo-waller

Describe the bug
In my application I use the BlazorBootstrap Autocomplete component to search for the name of machines.
After I select one of the suggestions, I call the "ResetAsync" method on the autocomplete to clear the input. Somehow the class "modified" is added to my autocomplete input field. Since I extend the bootstrap ".is-valid"-class a green checkmark icon is displayed at the end of the input.

Expected behavior
I would expect that after selecting a suggestion from the autocomplete component and calling the "ResetAsync"-method, the class "modified" isn't set on the autocomplete so no checkmark icon is displayed.

Screenshots
is-valid extension in *.scss-file
image

UI before suggestion is selected
image

UI after suggestion is selected
image

HTML-Source before suggestion is selected
image

HTML-Source after suggestion is selected
image

Versions (please complete the following information):

  • BlazorBootstrap: 1.10.5
  • Blazor WebAssembly / Server: Server
  • .NET Version: .NET8

Sample code
<AutoComplete @bind-Value="@EnteredText" TItem="ItemWithIdAndNameViewModel" DataProvider="LoadSuggestionsAsync" PropertyName="@nameof(ItemWithIdAndNameViewModel.Name)" Placeholder="@MaschineListComponentRes.SearchMaschine" OnChanged="Add" @ref="@AutoCompleteReference"/>

private async Task Add(ItemWithIdAndNameViewModel? selectedMaschine) { if (selectedMaschine != null) { SelectedMaschinen.Add(selectedMaschine); await AutoCompleteReference.ResetAsync(); } }

Desktop (please complete the following information):

  • OS: Windows 11
  • Browser: Chrome
  • Version: 121.0.6167.185

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions