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

Document interaction between native and React events #220

Closed
wants to merge 1 commit into from

Conversation

srittau
Copy link

@srittau srittau commented Oct 28, 2017

Closes #68.

I tried to make the wording as concise and clear as possible, although there is certainly room for improvement. The wording in both files is slightly different to fit the style of the respective document better.

@facebook-github-bot
Copy link
Collaborator

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need the corporate CLA signed.

If you have received this in error or have any questions, please contact us at [email protected]. Thanks!

@reactjs-bot
Copy link

Deploy preview ready!

Built with commit 32a9908

https://deploy-preview-220--reactjs.netlify.com

@facebook-github-bot
Copy link
Collaborator

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

@@ -58,6 +58,10 @@ Here, `e` is a synthetic event. React defines these synthetic events according t

When using React you should generally not need to call `addEventListener` to add listeners to a DOM element after it is created. Instead, just provide a listener when the element is initially rendered.

> Note:
>
> For performance reasons, React events are not guaranteed to be installed on the element they are created on. This means that using `stopPropagation` from event handlers installed outside of React might not be able to stop React events from occurring and vice versa.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure about the wording "installed on" or "installed outside of".

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was looking for a good word here. I am not happy with "installed" myself, but it was the best I could come up with. Suggestions welcome!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Sorry. Hit enter before I intended to.) What do you think about something like this?

Note:

React uses event delegation for performance reasons. Generally this is not observable but it is worth noting if you also use the browser's event system directly (via addEventListener). For example, calling stopPropagation() on a synthetic event will not prevent a native event handler from being executed.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(I'm also not sure about the wording here. Just offering an idea.)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Friendly ping 😄

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bvaughn Sorry for the late reply. I like your version better than mine, although I needed a bit to understand what "observable" meant in this context. I was looking for a technical meaning. But that is bikeshedding territory.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No problem. Want to take a stab at updating the wording then?

jhonmike pushed a commit to jhonmike/reactjs.org that referenced this pull request Jul 1, 2020
@srittau
Copy link
Author

srittau commented Jan 1, 2021

I am sorry for dropping this. With React 17, this seems obsolete, closing.

@srittau srittau closed this Jan 1, 2021
BetterZxx pushed a commit to BetterZxx/react.dev that referenced this pull request Mar 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Document (non-)interaction between native and synthetic events
4 participants