-
Notifications
You must be signed in to change notification settings - Fork 47.6k
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
Undo behavior in controlled textareas works differently from the default behaviour in chrome #8514
Comments
I hit this as well. On chrome CMD+Z undoes one character at a time in a React-controlled textarea. On FireFox and Safari undo is still grouped as expected. Interestingly DOM.input() is not affected. |
For the record, this bug also appears to repro whenever the |
Is there a known workaround for this? @syranide mentioned potentially reverting the value-reflecting behavior; would that work? What are the trade-offs there? |
Possibly related: https://bugs.chromium.org/p/chromium/issues/detail?id=746483 |
If you control a textarea with value, it behaves differently when you use undo. When the textarea is controlled, you can only undo one letter at a time. This is not how undo works normally with an uncontrolled component. Undo seems to work as expected with input components.
With a controlled textarea component, you can only undo one letter at a time. The normal undo works with some kind of algorithm for how much is going to be un- or redone.
You can try the difference in this codepen:
https://codepen.io/fabsor/pen/LbmBOv
Tested with React 15.3.1 and Chrome 54 and Chrome Canary. Works as expected in Firefox and Safari. It might be a Chrome bug?
The text was updated successfully, but these errors were encountered: