You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe the problem.
I am using a CustomElement in Blazor that implements checkbox functionality. The component reports the state of checked/unchecked in an identical fashion as a native <input type="checked"> The determination of a checkbox in RenderingEventForDotNet only works for native input controls.
I posit that there are always going to be some edge cases where mapping the Value can't get handled with addition of a role or other methodology and that other elements of the event may be required.
I can certainly add my own event listener on the custom element and call back into Blazor with the checked state. This works but I consider it ugly.
Slightly less ugly (but I guess it is in the eye of the beholder) I simply created a custom event that grabs the checked attribute. Again, it works, but still not really elegant.
I propose standard events have two maps, the current simplified map so oninput, onchange, etc. all work as they do now and a second set that returns the complete event. These could be named as ondomchange, ondominput or onnativechange, onnativeinput. There would have to be corresponding types in C# that reflect the TypeScript definitions found in lib.dom.d.ts
The goal is just to make it easier in Blazor to use CustomElements that may not be wrapping a native element.
Is there an existing issue for this?
Is your feature request related to a problem? Please describe the problem.
I am using a CustomElement in Blazor that implements checkbox functionality. The component reports the state of checked/unchecked in an identical fashion as a native <input type="checked"> The determination of a checkbox in RenderingEventForDotNet only works for native input controls.
This has been discussed as early as the late stages of .Net 5 with some suggestions and even an incomplete PR
IsCheckbox based on role and not only for input DOM elements #27030
[Blazor] Cannot bind custom checkbox element's checked value
But here we are at .Net 9 and no relief...
Describe the solution you'd like
I posit that there are always going to be some edge cases where mapping the Value can't get handled with addition of a role or other methodology and that other elements of the event may be required.
I can certainly add my own event listener on the custom element and call back into Blazor with the checked state. This works but I consider it ugly.
Slightly less ugly (but I guess it is in the eye of the beholder) I simply created a custom event that grabs the checked attribute. Again, it works, but still not really elegant.
I propose standard events have two maps, the current simplified map so oninput, onchange, etc. all work as they do now and a second set that returns the complete event. These could be named as ondomchange, ondominput or onnativechange, onnativeinput. There would have to be corresponding types in C# that reflect the TypeScript definitions found in lib.dom.d.ts
The goal is just to make it easier in Blazor to use CustomElements that may not be wrapping a native element.
@SteveSandersonMS
Additional context
No response
The text was updated successfully, but these errors were encountered: