Skip to content

Conversation

@Jidayyyyyy
Copy link

Summary

Improve the developer-facing warning messages in DOMEventPluginSystem.js for non-delegated events.

Problem

Currently, React emits vague warnings like:

  1. "Did not expect a listenToNonDelegatedEvent() call for '%s'. This is a bug in React. Please file an issue."
  2. "Did not expect a listenToNativeEvent() call for '%s' in the bubble phase. This is a bug in React. Please file an issue."

These messages are unclear and provide little guidance to developers about what went wrong or how to fix it.

Change

Updated the warnings to be more descriptive and actionable:

  1. listenToNonDelegatedEvent warning:
    "React detected a call to listenToNonDelegatedEvent() for '%s', which should only be used for non-delegated events (e.g., media events, scroll). Check if this event should be handled differently or remove the call."

  2. listenToNativeEvent warning:
    "React detected a call to listenToNativeEvent() for '%s' in the bubble phase on a non-delegated event. Ensure this event is not in nonDelegatedEvents or adjust the phase."

Notes

  • These changes only affect development mode warnings.
  • No runtime behavior changes in production.
  • Helps developers quickly identify incorrect event usage in React's event system.

@meta-cla
Copy link

meta-cla bot commented Oct 14, 2025

Hi @Jidayyyyyy!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign 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 to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

Copy link
Collaborator

@eps1lon eps1lon left a comment

Choose a reason for hiding this comment

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

This would be a React bug. There's nothing actionable for the user to do so the message shouldn't try to act like it.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants