Skip to content
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

Attach event per react container root, rather than on the document #2043

Closed
chenglou opened this issue Aug 14, 2014 · 9 comments
Closed

Attach event per react container root, rather than on the document #2043

chenglou opened this issue Aug 14, 2014 · 9 comments

Comments

@chenglou
Copy link
Contributor

@nathansobo will that help your event perf issues a bit? I'm not familiar with atom's plugin infrastructure, But this'll help if you have <Editor/><Plugin1/> (two renderComponents). Doesn't help if you have <Editor><Plugin1/></Editor> though, but I have some ideas to optimize events a bit more.

This is nonetheless an ok idea, I think.
@spicyj

@chenglou chenglou self-assigned this Aug 14, 2014
@nathansobo
Copy link

@chenglou That would help our situation with the editor a bit, yes. But what's more important for Atom I think is the ability to integrate React with HTML custom elements without requiring the use of the shadow DOM. Seems like #1711 would help that, and it seems like this idea might be necessary to achieve that as well?

@sophiebits
Copy link
Collaborator

@nathansobo Can you clarify what you mean, "without requiring the use of the shadow DOM"? I'm a bit uninformed about how HTML custom elements work right now.

chenglou added a commit to chenglou/react that referenced this issue Aug 20, 2014
Work in progress. `enterleave` plugin (and maybe `analyticsPlugin`) is broken because it relied on the old behavior. But wanted to put this out here for suggestions. There are also some comments that need to be changed, I'll do it when the code is finalized.

If we attach the event listening/dispatching at container level, it'll benefit the case of `<Editor/><Plugin1/>` (both are container roots), since `Plugin1` won't disturb `Editor`.

We also detach those listeners now. There wasn't really a need in the past.

Fixes facebook#2043
Should help with facebook#1964
@syranide
Copy link
Contributor

@chenglou It seems we have your #2050 to track this. Closing, reopen if you disagree :)

@sophiebits
Copy link
Collaborator

@syranide I don't see why we should close issues just because there's a PR open – what if we don't go with that particular implementation? We may still want to make the same fix.

@syranide
Copy link
Contributor

@spicyj Fair enough :)

@syranide syranide reopened this Sep 29, 2014
fcsonline added a commit to fcsonline/react that referenced this issue Jun 20, 2016
Current React implementation is attaching events to `document` level.
This is breaking bubbling DOM behaviour not letting users to play
properly with methods like `stopPropagtion`.

Also attaching events to containers instead of `document` integrates
better with other Javascript frameworks.

With this change we start attaching events at container level.

Fixes:
facebook#2043
facebook#4335
fcsonline added a commit to fcsonline/react that referenced this issue Jun 20, 2016
Current React implementation is attaching events to `document` level.
This is breaking bubbling DOM behaviour not letting users to play
properly with methods like `stopPropagtion`.

Also attaching events to containers instead of `document` integrates
better with other Javascript frameworks.

With this change we start attaching events at container level.

Fixes:
facebook#2043
facebook#4335
fcsonline added a commit to fcsonline/react that referenced this issue Jun 20, 2016
Current React implementation is attaching events to `document` level.
This is breaking bubbling DOM behaviour not letting users to play
properly with methods like `stopPropagtion`.

Also attaching events to containers instead of `document` integrates
better with other Javascript frameworks.

With this change we start attaching events at container level.

Fixes:
facebook#2043
facebook#4335
fcsonline added a commit to fcsonline/react that referenced this issue Jun 20, 2016
Current React implementation is attaching events to `document` level.
This is breaking bubbling DOM behaviour not letting users to play
properly with methods like `stopPropagation`.

Also attaching events to containers instead of `document` integrates
better with other Javascript frameworks.

With this change we start attaching events at container level.

Fixes:
facebook#2043
facebook#4335
@gaearon
Copy link
Collaborator

gaearon commented Nov 21, 2017

As far as I can tell #8117 was the latest attempt to do this. It has requested changes (that weren't addressed). So if somebody wants to pick this up they'll probably want to read the discussion there.

@kentcdodds
Copy link

Just FYI, this effort may get new life due to: testing-library/react-testing-library#35

If I can't push this along myself, I'll try to encourage others to do so. Thanks!

@gaearon
Copy link
Collaborator

gaearon commented Apr 23, 2020

@trueadm has been working on this. Not yet 100% sure but it's likely we'll do this change in a major (right now it's behind a flag).

@gaearon
Copy link
Collaborator

gaearon commented Aug 11, 2020

We did this.
https://reactjs.org/blog/2020/08/10/react-v17-rc.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants