-
Notifications
You must be signed in to change notification settings - Fork 10k
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
Support multiple event handlers for the same event on the same element #14365
Comments
Let's be careful when we get here - this kind of solution will be really tricky because we don't want to influence evaluation order. |
Agreed it's tricky. One especially difficult bit, that might even be fatally difficult to most designs, is making this work alongside our existing Maybe the distinction is just "event handlers combine, other things overwrite" but I'm not confident that's desirable without a lot more careful consideration. |
I've ran into this with my toy application: three sliders that are bound to three properties and must recalculate a few output properties on change. The most concise way would be to This means that |
@SteveSandersonMS For event handlers, you could add |
Thanks for contacting us. |
We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process. |
I would very much like to see this worked on. I have in many components implemented an EventCallback parameter such as If you could support @bind-Value with also having a custom ValueChanged unrelated to the binding, that would clean this up a lot. I would not expect it to be super-deluxe foolproof, just to finish the @Bind function (which should always be quite fast, right?) and then start the custom ValueChanged function. |
Note that #39837 supersedes this requirement. That might seem different, but it's a proposal to enhance |
Closing as this is being superseded by #39837 which we've decided to move forward with. |
Currently, Blazor only allows a single
onsomething
for a given element. A consequence of this is that:@bind
you can't also use@onchange
(because the framework is using it)@bind:event="oninput"
you can't also use@oninput
(because the framework is using it)This is a limitation we should be able to relax, and would help fix issues like #14242 (comment)
Ways we could fix it:
@onsomeevent
(including ones it creates itself via@bind
) and collapse them into a single@onsomeevent
that calls a code-genned method that runs all the handlers.StateHasChanged
calls that run after each of the returned tasks complete, so as to preserve the usual updating behavior?The text was updated successfully, but these errors were encountered: