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 Not Triggering for range input After Dynamic Updates #32195

Open
weirenxue opened this issue Jan 23, 2025 · 0 comments
Open

Bug: onChange Not Triggering for range input After Dynamic Updates #32195

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

Comments

@weirenxue
Copy link

weirenxue commented Jan 23, 2025

Description

When using range input in React, the onChange event does not trigger properly under certain dynamic updates to its step and max attributes. Specifically, if the step and max values are updated dynamically, and the range input value is reset to 0, subsequent user interactions with the range slider fail to trigger the onChange event as expected. This behavior does not occur in a pure JavaScript implementation.

React version: 19.0.0

Steps To Reproduce

  1. Open the StackBlitz example: React example
  2. Click the middle of the range input, changing its value to 500.
  3. Click the "Change to step 0.5 max 1" button, observe that the range input is set to 0 (expected behavior).
  4. Click the "Change to step 500 max 1000" button, observe that the range input is set back to 0. Then click the middle of the range input.

The current behavior

After completing step 4, the value of the range input remains at 0, even though the user clicks on the middle of the range slider. The onChange event is not triggered, and the value does not update.

The expected behavior

After completing step 4, the value of the range input should update to 500 when the user clicks on the middle of the range slider. The onChange event should be triggered correctly, reflecting the value change.

Link to code example


Screen.Recording.2025-01-23.at.7.24.24.PM.mov
@weirenxue weirenxue added the Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug label Jan 23, 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