Skip to content
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

stopPropagation on actions is broken #515

Open
bazubii opened this issue Feb 23, 2023 · 4 comments
Open

stopPropagation on actions is broken #515

bazubii opened this issue Feb 23, 2023 · 4 comments

Comments

@bazubii
Copy link
Contributor

bazubii commented Feb 23, 2023

It looks like at some point, the action event handlers were moved to the document (checking that the target is correct). It seems like this totally breaks the .stop modifier. That calls stopPropagation, but that doesn't work if its an event on the document. There is nothing to stop propagation to. The intended behavior would seem to be to stop propagation from the element the action is on to parent elements, but that isn't working if the event is actually on the document.

@adamghill
Copy link
Owner

They got moved to the document because the events were getting re-added on every update. That would cause the event to fire multiple times. I'm pretty sure I tried a few approaches to prevent it from happening, but resorted to keeping the events on the document as a last resort. If there is a smarter approach I'd love to check it out.

@bazubii
Copy link
Contributor Author

bazubii commented Feb 23, 2023

Ah that makes sense. I don't have a proposed solution as of yet, but the docs at least are incorrect in saying it'll work. I'll have to think and play with it a bit.

@adamghill
Copy link
Owner

but the docs at least are incorrect in saying it'll work

True. If there isn't an easy solution I could remove it from the docs (at least for now).

@bazubii
Copy link
Contributor Author

bazubii commented Feb 24, 2023

I couldn't figure out any good solution myself. Since the event listener I didn't want to trigger was under my control, I added a quick hack to see if the target had a 'unicorn:***.stop' attribute and skipped the work. Not a general solution but a sufficient workaround for me for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants