Undo in controlled TextField stops working after leaving component #18545
Labels
bug 🐛
Something doesn't work
component: text field
This is the name of the generic UI component, not the React module!
external dependency
Blocked by external dependency, we can’t do anything about it
When using TextField in a controlled manner, you lose the ability to undo steps as soon as focus on the element is lost. Uncontrolled TextFields work fine.
For instance, on the TextField demo page, scroll to the "Uncontrolled vs Controlled" section. Input text into the "Name" field, then the "Uncontrolled" field, then the "Name" field again, and then the "Uncontrolled" field again. Use Ctrl/Cmd+Z or Edit->Undo to undo changes. The changes made in the uncontrolled field will be undone, but the changes in the controlled field will not. Focus will be changed to the uncontrolled field, but the data will not be changed.
As far as events goes, if an Undo command is triggered while the TextInput remains focus, then an onChange event will be fired. If you make changes, then leave focus, then trigger the Undo, then onChange events will not be fired.
The text was updated successfully, but these errors were encountered: