Skip to content

How Blazor handles the events? onclick:stopPropagation cannot prevent native JS events from bubbling up. #52956

Answered by javiercn
zxyao145 asked this question in Q&A
Discussion options

You must be logged in to vote

Blazor relies on event delegation and will listen to the events at the root, which means events bubble all the way before they get stopped. If you want to stop the event at the element level you need to use JS interop to setup a handler on the element itself.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@zxyao145
Comment options

Answer selected by javiercn
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
area-blazor Includes: Blazor, Razor Components
2 participants