Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I'm excited to see the work on the Modern Event System land. I tried to dig into all the events code in React to understand how events in React Portals bubbled up because I wanted to prevent them from bubbling out of the portal in many cases (GH issue: https://github.com/facebook/react/issues/11387). In 16.x, the modern event system was in the tree but unused by default, and it was very confusing to try to trace event handling logic between the two event systems. Removing the legacy event system will make the event system much more accessible to new contributors.

Can someone on the React team speak to how event delegation works when there are portals present? Where is the event handler for a portal bound, and how does the new events system handle event bubbling across multiple versions of React in portal trees?



Yeah, we've removed a lot of code and also a lot of abstraction so the event system should be easier to follow now. We listen to events on both roots and portal containers — this is why it keeps working.

I can't speak to the exact semantics of how portals work with nested trees, but if you find an issue, please file one on our tracker. Some are expected to be impossible to solve, but hopefully we handle the common cases well.

(I would ask Dominic who worked on this but he just went on a much needed holiday break.)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: