-
Notifications
You must be signed in to change notification settings - Fork 10.2k
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
[Blazor] Binding fails inside SVG foreignobject
tag
#13290
Comments
@dmorrison42 Thanks for reporting this issue! We know we have a bunch of issues with using SVGs with Blazor. For 3.0 we plan to document the known limitations and then we will look into addressing these issue more fully in a future release. |
Thanks for the roadmap! Does anyone know of a workaround? The only one I've come up with thus far is to create my own input components in SVG, but that may run into other issues. |
I stumbled across the same issue and didn't found a good workaround. I would love to see this bug fixed. |
I encountered this issue as well. It's not a workaround since I couldn't get any Blazor-bound foreignObject to display, but I was able to use Blazor JavaScript interop. It is painful, but from Blazor code, whenever the foreignObject gets created, I can use [IJSRuntime].InvokeVoidAsync extension method along with DotNetObjectReference.Create. The target JavaScript function has to attach my DOM events to the element and keep track of the DotNetObjectReference.Create parameter value. When the event fires, I have to use the parameter and call invokeMethodAsync to fire a JSInvokable-attributed method back in Blazor. With this approach, I faced an issue where the initial JavaScript interop fires before the DOM elements exist to attach events so you have to workaround that as well (such as with setTimeout). Also, you will may get a hard-to-diagnose error if you did not expose your JSInvokable-attributed method as public. This is just for binding an event. Handling DOM updates inside the foreignObject have be all coded manually. Please fix, thanks! |
Closing as we will be tackling this as part of #18271 |
Describe the bug
Cannot bind to an input inside of a foreignobject svg tag.
Instead, the input tag fails to render completely with no errors in the web or server console.
To Reproduce
Attempt to do a bind inside of a foreignobject svg tag. (tested on server side blazor)
(Example)
Expected behavior
Bind works as with a native input.
Additional context
The text was updated successfully, but these errors were encountered: