-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Checkbox onClick and onChange fire too late #1247
Comments
In further testing, I'm seeing some weird behavior with just React and simple HTML elements. React-mounted elements have their event capture and bubble after elements that start in the HTML. Is this expected? I'll take my issue over to the React project as well. Here is a new test case. |
Mystery solved: this is due to React's choice to only support attaching listeners to the |
Bear in mind React is a JS implementation of the DOM, aka, the virtual DOM. The event system in React is not the event system that is in the browser. These are two different mechanisms with two different APIs firing at two different times https://facebook.github.io/react/docs/events.html A React app can be loaded on part of the page as well. However, React must own all DOM interaction including events and manipulation. |
Fully aware of the virtual DOM, but only just learned React lets events escape and bubble through the page instead of scoping them to the virtual DOM. I would phrase it as "React assumes it owns all DOM interaction". |
Steps
Checkbox
as a child of an element with anonclick
handler. Granted, this likely isn't a problem if your entire page is built with SUIR, but I do not have that luxury in my use case.onClick
handler to the SUIR Checkbox that callsevent.stopPropagation()
.Expected Result
The parent element's
onclick
handler should not be called.Actual Result
The parent element's
onclick
handler is called before theCheckbox
'sonClick
.Version
0.64.0
Testcase
https://codepen.io/anon/pen/dNZBrr
The text was updated successfully, but these errors were encountered: