Fix: InputRadioGroup not registering initial click in some circumstances#39208
Fix: InputRadioGroup not registering initial click in some circumstances#39208MariovanZeist wants to merge 2 commits into
Conversation
|
The main challenge with this PR was the fact that if you use a primitive value for aspnetcore/src/Components/Components/src/ChangeDetection.cs Lines 39 to 45 in a450cb6 An The solution here was to maintain a list of actions to call when an |
|
Thanks for your PR, @MariovanZeist. |
66d3a7b to
1d6538e
Compare
|
Just a note for anyone reviewing this: we should compare the underlying issue against the one reported at #39145. If it's the same underlying problem, we might want to look for a non-radiogroup-specific fix. |
|
@SteveSandersonMS The issue #39145 has 2 different (Nonrelated issues) |
|
Fixed in @40148 |
Fixes InputRadioGroup not registering initial click
I have created a simple repo to show the issue: https://github.com/MariovanZeist/InputRadioGroupDoubleClick
The problem was the use of an
InputContextas a key for the renderer.As this Context was recreated every time the
InputRadioGroupwas rendered, all its Content was also recreated.When you have an
InputTextfor example, and you would edit the text and without pressing enter or tab out of the input would click on aInputRadioelement, first theOnChangeof theInputTextwould fire, forcing a rerender of theInputRadioGroupwhich in turn would rebuild its content, and would lose theclickevent (As the HTML that was clicked on is now gone)Description
The solution was to change the way
InputContextwas created, but also honor #24762 where the issue was introduced.The biggest hurdle was to fix the Issue with no breaking changes,
Most of the changes are to internal classes so won't affect other developers.
The only change that could be considered breaking is the addition of the IDisposable interface to a
InputRadiocomponent, but I could not find a solution without it.2 e2e tests have been added
Fixes #31610
Fixes: #39145 (comment)