InputText and other input components do not use SetUpdatesAttributeName() for two-way binding #40097
Closed
1 task done
Labels
area-blazor
Includes: Blazor, Razor Components
bug
This issue describes a behavior which is not expected - a bug.
Done
This issue has been fixed
feature-blazor-builtin-components
Features related to the built in components we ship or could ship in the future
help wanted
Up for grabs. We would accept a PR to help resolve this issue
Milestone
Is there an existing issue for this?
Describe the bug
Hi @SteveSandersonMS,
is there any reason why the
InputText
implementation (and implementation of other input components) do not use theSetUpdatesAttributeName("value")
method when it replicates the<input @bind-value="..." />
inBuildRenderTree()
?The changes in DOM get not synchronized to the .NET model then.
As a result when someone wants to derive his own component from
InputText
e.g. to apply some text formatting and you enter the same text input twice, the first callback causes the UI to replace the value with the formatted value but the second callback leaves the input intact as it does not detect any change in the .NET model to be synchronized to DOM (no matter you call theStateHasChanged()
or not).Expected Behavior
.NET model of
InputText
and other input components reflect DOM changes (two-way binding) from their underlyinginput
elements.Steps To Reproduce
This fixes the issue:
Exceptions (if any)
No response
.NET Version
6.0.101
Anything else?
If it helps, I can prepare a PR for this.
Related issue #17281
The text was updated successfully, but these errors were encountered: