-
Notifications
You must be signed in to change notification settings - Fork 10.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"There is no event handler associated with this event" when an element is focused out #26838
Comments
Thanks for contacting us. |
I did some investigation on this today, and confirmed it is a current bug. The repro can be simplified to: @if (showButtonThatDisappearsWhenClicked)
{
<button @onfocusout="HandleFocusOut" @onclick="HandleClick">Click me</button>
}
@code {
bool showButtonThatDisappearsWhenClicked = true;
void HandleClick()
{
Console.WriteLine("click");
showButtonThatDisappearsWhenClicked = false;
}
void HandleFocusOut()
{
Console.WriteLine("focusout");
}
} This works OK on Blazor Server but throws on Blazor WebAssembly. On wasm, the sequence of events is:
Possible resolution:
|
@majorimi It's not clear to me that what you're posting here is the same thing as this issue. Instead of posting here, could you please file a new issue giving a clear description of what you're doing (since it's likely totally different)? |
@SteveSandersonMS: I was trying out Also my point was if this event is supported by Blazor and works perfectly, why Visual Studio 2019 Intelligense is not offering it when I'm typing Sure lets post it to a new issue, however not sure if is it belongs to this repo or should be posted for VS team? Thanks. |
Yes please, in this repo. |
Just a note that this breaks data binding scenarios:
I haven't found a reliable workaround. Changing the |
I am also facing the same script issue. Any workarounds for resolving this ? |
@RobertBouillon @Indrajith-Sync If you could each post separate issues with your own minimal repro steps, we can figure out whether it’s the same issue or not. Thanks! |
@SteveSandersonMS Can you clarify if a potential fix will be backported to the 3.x branch or will it be part of the upcoming 5.0.1 release only? I need to support both 3.x and 5.0, so this information will be helpful to me beforehand. |
We don't have a decision about that yet, however as a caution, please note that 3.2.0 is not an LTS release and hence doesn't come with support beyond (I think) February 2021. Developers using Blazor WebAssembly should upgrade to 5.0 before February 2021. |
You are probably referring to the 6.0-preview1 milestone targeting February 10, 2021 for an end date for wasm 3.2.0, but are any fixes for wasm going to be part of any of the 3.1.x releases? As far as I understand, Blazor WebAssembly 3.2.0 is not considered to be connected with the 3.1 LTS (ending on December 3, 2022), but I cannot find any official statement about that, am I correct? |
You can find out more about support policy and roadmap at https://dotnet.microsoft.com/platform/support/policy/dotnet-core. You are correct that 3.2.x is not part of the 3.1.x LTS release (in fact, that's why we gave it the 3.2.0 version originally). |
Can anyone confirm which release version, will this fix be included? |
@SteveSandersonMS I've failed to create a minimal repro thus far. I've put a couple hours into it. Every simple scenario I create seems to work, so I've been unable to isolate the exact problem here. I can provide you with access to the repo, if you'd like, otherwise I'll try and take another stab at this sometime this month by stripping away functionality until the problem disappears, rather than trying to recreate something simple. |
@RobertBouillon @SteveSandersonMS I've run into this error and managed to reproduce it in the latest .NET 5 for Blazor WebAssembly with this bit of code:
Navigate to the page, then focus on the input field and hit the enter button. The problem lies in the combination where I have a blur and a keydown event handler on an input field. The keydown event handler effectively removes the input field from the DOM, causing the blur event to -kinda- get triggered, but it can't find its associated element anymore. Hope this helps. |
Thanks for the clarification. Yes, I believe this is a duplicate repro of this issue (#26838). It's in "Next spring planning" so we'll be evaluating it for a possible fix in 5.0.2. |
@SteveSandersonMS |
just got recently
|
The same issue when i submit a form with enter key and then I navigate:
|
Describe the bug
An error is thrown:
when an element with focusout handler is removed from the DOM in a blazor wasm app (both 3.1 and 5.0).
To Reproduce
Index.razor
page, click onitem 2
that has @onfocusout handlerExceptions (if any)
Further technical details
dotnet --info
Additional context
A similar problem is marked to be fixed in multiple cases like:
#17926
#21241
#21366
#21874 (comment)
but the problem is still reproducible in both the 3.1 and 5.0 versions.
The text was updated successfully, but these errors were encountered: