Skip to content

events applied from a use:action ignore stopPropagation in child elements in Svelte 5 #13299

Answered by brunnerh
Freeplayg asked this question in Q&A
Discussion options

You must be logged in to vote

Svelte 5 uses event delegation and you need to subscribe using on from 'svelte/events' for stopPropagation to behave as expected.

[...] calling event.stopPropagation() inside a declarative handler won't prevent the programmatic handler (created inside an action, for example) from running.

Docs - Adjusted REPL

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@Freeplayg
Comment options

@brunnerh
Comment options

Answer selected by Freeplayg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants