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

Svelte 5: bind:this prevents any child from stopping the propagation of an event to its parents #9688

Closed
chainlist opened this issue Nov 28, 2023 · 0 comments · Fixed by #9696

Comments

@chainlist
Copy link

chainlist commented Nov 28, 2023

Describe the bug

Hello,

Discovered a bug on svelte 5 with the bind:this.

Using bind:this on a element will break the bubbleing behavior for every child element down the DOM tree.
Any stopPropagation() triggers on an event in a child element will not stop correctly the propagation of the event and the parent will then still receive the event.

After a little investigation, it does not seem to come from the new way of attaching the events onevent instead of on:event neither having the runes mode on.

Something weird is really happening with the bind:this feature.

Reproduction

Here's the bug reproduction REPL on Svelte 5
The same thing running correctly with Svelte 4

Expected behavior: Click on the div with red border on Svelte 5 should not trigger the parent event because the propagation was stopped in the child.

Logs

No log

System Info

N/A

Severity

blocking an upgrade

@chainlist chainlist changed the title Svelte 5: Attaching an event to a tag with bind:this breaks the bubble behavior Svelte 5: Attaching an event to a element with bind:this breaks the bubbling phase of events Nov 28, 2023
@chainlist chainlist changed the title Svelte 5: Attaching an event to a element with bind:this breaks the bubbling phase of events Svelte 5: Attaching an event to a element with bind:this prevents any child to stop the propagation of an event to its parents Nov 28, 2023
@chainlist chainlist changed the title Svelte 5: Attaching an event to a element with bind:this prevents any child to stop the propagation of an event to its parents Svelte 5: bind:this prevents any child from stopping the propagation of an event to its parents Nov 28, 2023
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

Successfully merging a pull request may close this issue.

1 participant