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
In Svelte 4, putting a use: action followed by an on: event handler on an element would first attach the action and then attach the event handler. In Svelte 5, it looks like event handlers are attached before the actions, regardless of the order they are specified on the element.
Yes it's a result of event delegation, with #11435 as a proposal to possibly fix this.
The reason they run out of order is that action functions are executed in an effect, because else the dom isn't attached yet and certain stuff doesn't work correctly (I don't remember the details, if I do we should document this in the code). I'm not sure how to best fix this, if we want to fix this. Put listeners inside an effect, too? Bindings are already inside effects AFAIK so that order is preserved.
Describe the bug
In Svelte 4, putting a
use:
action followed by anon:
event handler on an element would first attach the action and then attach the event handler. In Svelte 5, it looks like event handlers are attached before the actions, regardless of the order they are specified on the element.Reproduction
https://svelte-5-preview.vercel.app/#H4sIAAAAAAAACnWQQW7DIBBFr4LY2JaidE-cSF101xvUXRAYp6h4xoIhUmX57gWHJN10A_z5_DcMixydhyjVxyJRTyCVfJ1nuZP8MxcRr-AZso6UgimVPprgZj4NOPCY0LAjFHrbWiQLnViKNXARe23t2xWQ311kQAhtY7wz381OtJ04noQhjORh7-lSLTEGmipQQMmKL43WQ2i67lDQa17-Nq92--j8HzTAJXkdnrw7rn95DoX9OTFnbIqg6jMI1YY5LjW6buPfLpb47ZSL-acmsm50YKXikGD9XH8B9L2B8mQBAAA=
Logs
No response
System Info
Severity
annoyance
The text was updated successfully, but these errors were encountered: