Description
Describe the bug
Unfortunately, I cannot reopen the 26838 issue so I'm creating a new one.
In the latest .NET 6 preview version an exception occurs if an element has the onfocusout event handled, and the click is handled in the asynchronous way.
To Reproduce
Run a project with the code below and click the button:
@if(show) {
<button @onfocusout="() => { }" @onclick="Click">Hide input</button>
}
@code {
bool show = true;
async Task Click() {
await Task.Delay(1);
show = false;
}
}
Exceptions (if any)
Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100] Unhandled exception rendering component: Cannot read property 'parentNode' of undefined TypeError: Cannot read property 'parentNode' of undefined at O (https://localhost:44354/_framework/blazor.webassembly.js:1:13297) at V.applyEdits (https://localhost:44354/_framework/blazor.webassembly.js:1:17125) at V.updateComponent (https://localhost:44354/_framework/blazor.webassembly.js:1:16469) at https://localhost:44354/_framework/blazor.webassembly.js:1:49688 at Object.he._internal.renderBatch (https://localhost:44354/_framework/blazor.webassembly.js:1:50058) at Object.ct [as invokeJSFromDotNet] (https://localhost:44354/_framework/blazor.webassembly.js:1:52281) at _mono_wasm_invoke_js_blazor (https://localhost:44354/_framework/dotnet.6.0.0-preview.4.21253.7.js:1:211543) at <anonymous>:wasm-function[5707]:0xdfd2f at <anonymous>:wasm-function[5802]:0xe1d70 at <anonymous>:wasm-function[2185]:0x459a5 Microsoft.JSInterop.JSException: Cannot read property 'parentNode' of undefined TypeError: Cannot read property 'parentNode' of undefined at O (https://localhost:44354/_framework/blazor.webassembly.js:1:13297) at V.applyEdits (https://localhost:44354/_framework/blazor.webassembly.js:1:17125) at V.updateComponent (https://localhost:44354/_framework/blazor.webassembly.js:1:16469) at https://localhost:44354/_framework/blazor.webassembly.js:1:49688 at Object.he._internal.renderBatch (https://localhost:44354/_framework/blazor.webassembly.js:1:50058) at Object.ct [as invokeJSFromDotNet] (https://localhost:44354/_framework/blazor.webassembly.js:1:52281) at _mono_wasm_invoke_js_blazor (https://localhost:44354/_framework/dotnet.6.0.0-preview.4.21253.7.js:1:211543) at <anonymous>:wasm-function[5707]:0xdfd2f at <anonymous>:wasm-function[5802]:0xe1d70 at <anonymous>:wasm-function[2185]:0x459a5 at Microsoft.JSInterop.WebAssembly.WebAssemblyJSRuntime.InvokeUnmarshalled[Int32,RenderBatch,Object,Object](String identifier, Int32 arg0, RenderBatch arg1, Object arg2, Int64 targetInstanceId) at Microsoft.JSInterop.WebAssembly.WebAssemblyJSRuntime.InvokeUnmarshalled[Int32,RenderBatch,Object](String identifier, Int32 arg0, RenderBatch arg1) at Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer.UpdateDisplayAsync(RenderBatch& batch) at Microsoft.AspNetCore.Components.RenderTree.Renderer.ProcessRenderQueue()
Further technical details
- ASP.NET Core 6.0.0-preview.4.21253.5
- VS 2019