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

Bug: event handlers in fragment roots #32423

Open
frolic opened this issue Feb 19, 2025 · 0 comments
Open

Bug: event handlers in fragment roots #32423

frolic opened this issue Feb 19, 2025 · 0 comments
Labels
Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug

Comments

@frolic
Copy link

frolic commented Feb 19, 2025

React version: 19.0.0

Steps To Reproduce

  1. Use createRoot with a document fragment instead of element
  2. Notice how none of the onFocus, onClick, onSubmit, etc. event handlers don't work

Link to code example:
https://codesandbox.io/p/sandbox/wonderful-tristan-lxwl5d

(Note that this uses the flushSync-before-append approach in #25101 (comment), but unclear if that's related to how events are bound.)

The current behavior

All event handlers bound with on* props inside the React root rendered to a document fragment don't seem to work. This can be worked around with refs and setting up event listeners.

The expected behavior

I would expect on* props to work the same as React roots rendered to elements.

@frolic frolic added the Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug label Feb 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug
Projects
None yet
Development

No branches or pull requests

1 participant