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: onChange is not triggered when the 'input' event listener changes the target's value. #29036

Open
timbo-dev opened this issue May 9, 2024 · 2 comments
Labels
Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug

Comments

@timbo-dev
Copy link

timbo-dev commented May 9, 2024

React version: 18.3.1

Steps To Reproduce

  1. Create a root component.
  2. Insert an input tag that contains an onChange prop.
  3. Call useRef to get the input.
  4. In a useEffect call, add an event listener with "input" as the listener.
  5. Observe how the onChange prop will not be triggered.

Link to code example

Vanilla JavaScript example

Current Behavior

After typing some characters into the input, the input event listener is triggered, changing the target.value property. However, for some reason, the onChange prop is not being triggered. If we comment out the line that changes the target.value, both listeners are triggered as expected.

Expected Behavior

The onChange prop should be triggered after the input event listener changes the target.value property.

@timbo-dev timbo-dev added the Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug label May 9, 2024
@timbo-dev timbo-dev changed the title Bug: onChange is not trigged when the 'input' event listener changes the target's value. Bug: onChange is not triggered when the 'input' event listener changes the target's value. May 9, 2024
@purvish-dhameliya
Copy link

assign to me

@timbo-dev
Copy link
Author

@purvish-dhameliya I don't have permissions for it.

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

2 participants