-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Closed as not planned
Closed as not planned
Copy link
Description
Describe the bug
Using stopPropagation on a parent element to create a boundary for event bubbling causes all of the event handlers for that event type (when attached directly with the onevent attribute) on children of that element to stop working.
This behavior only exists when using the Svelte 5 syntax for attaching events to elements (e.g. using on:event works, but onevent does not).
Reproduction
<script>
function onClick() {
console.log('CLICKED')
}
function stopPropagation(el, type) {
el.addEventListener(type, event => event.stopPropagation())
}
</script>
<div>
<button onclick={onClick}>Click me, I work.</button>
</div>
<div use:stopPropagation={'click'}>
<button onclick={onClick}>Click me, I don't work</button>
</div>Logs
System Info
System:
OS: macOS 15.3
CPU: (10) arm64 Apple M1 Pro
Memory: 561.53 MB / 32.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 22.13.0 - /opt/homebrew/bin/node
npm: 11.0.0 - /opt/homebrew/bin/npm
bun: 1.2.2 - ~/.bun/bin/bun
Browsers:
Chrome: 133.0.6943.100
Safari: 18.3
npmPackages:
svelte: ^5.20.2 => 5.20.2Severity
blocking an upgrade
Metadata
Metadata
Assignees
Labels
No labels