-
Notifications
You must be signed in to change notification settings - Fork 239
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
Cannot set the cursor position after programmatically modifying the value of input #971
Comments
I think it's caused by this code user-event/src/document/value.ts Line 149 in 7b0643b
|
Thanks for the report. You're right. This is caused by us reapplying value changes we collected during the The underlying problem is that We currently work around this by intercepting all changes to The Maybe there's a smarter workaround doing less harm. |
I Have the same problem. My code is pretty much the same as shown in the codesandbox provided by dnt1996.
Error console log: Expected the element to have value: I use the following following environment: |
🎉 This issue has been resolved in version 14.2.6 🎉 The release is available on: Your semantic-release bot 📦🚀 |
@all-contributors add @dnt1996 bug |
@dnt1996 already contributed before to bug |
Reproduction example
https://codesandbox.io/s/serene-lehmann-1fkp6j?file=/src/App.test.js
Prerequisites
None
Expected behavior
The position of the cursor should always be 2 if you enter anything in input
Actual behavior
The cursor position is always reset to the end
User-event version
14.2.0
Environment
Testing Library framework: @testing-library/react@11.2.5
JS framework: react@16.14.0 react-dom@16.14.0
Test environment: jest@26.0.21 @testing-library/jest-dom@5.11.9
DOM implementation: jsdom@16.4.0
Additional context
No response
The text was updated successfully, but these errors were encountered: