Skip to content

bug(AutoComplete): trigger OnBlurAsync when clicking outside #5475

@celadaris

Description

@celadaris

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

Testing OnblurAsync doesnt work. When i click away from the AutoComplete form it doesn't trigger the attached function.

I believe before OnBlurAsync would trigger when pressing Enter, clicking away, and selecting a new Item

now it only triggers when Selecting a new Item

Expected Behavior

It should trigger when clicking away from the form, as far as the other functionality goes:

its fine if it triggers on those other conditions

But if it doesn't then it would need play well with other attributes like OnEnterAsync/OnSelectedItemChanged

Interactive render mode

Interactive Server (Interactive server-side rendering (interactive SSR) using Blazor Server)

Steps To Reproduce

I downloaded the github source and modified index.razor to this:

@layout HomeLayout
@page "/"
@page "/index"
@page "/home"
@using System.Diagnostics
@inject IOptionsMonitor<WebsiteOptions> WebsiteOption

<ValidateForm Model="sampleModel" OnInvalidSubmit="Invalid" OnValidSubmit="Valid" DisableAutoSubmitFormByEnter="true">
    <AutoComplete OnBlurAsync="hello"></AutoComplete>
</ValidateForm>

<AutoComplete OnBlurAsync="hello"></AutoComplete>
<Button Text="TestBtn" OnClick="@(() => hello("hi"))"></Button>

@code{
    SampleModel sampleModel = new SampleModel();

    async Task hello(string value)
    {
        Debugger.Break();
    }

    async Task Valid(EditContext context)
    {
        Debugger.Break();
    }

    async Task Invalid(EditContext context)
    {
        Debugger.Break();
    }

    class SampleModel()
    {
        public string Input { get; set; } = string.Empty;
    }
}

Exceptions (if any)

No response

.NET Version

NET8.0

Anything else?

I am using the current latest v9.4.3-beta01 from the github source

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions