[TextField] Floating label doesn't reset when resetting the form node
Hello,
Problem description
When I reset a form with uncontrolled inputs in it, the values are cleared but the floating label doesn't reset inside the TextField.
Link to minimally-working code that reproduces the issue
http://www.webpackbin.com/4kIJtmmNf
Versions
- Material-UI: 0.16.5
- React: 15.4.1
- Browser: Chrome Version 55.0.2883.87 m (Win10)
@jgoux, why did you reset() a form with no initial values?
when a form is reset, each control's current value is reset to its initial value. If a control does not have an initial value, the effect of a form reset on that control is undefined. – W3C
@frooeyzanny I think @jgoux wants to reset the form after the uncontrolled <TextField /> got input value.
In this case, the <TextField />'s <input> (a form element) got reset by the form reset event but <TextField /> itself, being a React element with existing, persistent state, never got reset to its initial state.
@frooeyzanny Adding a reset function to <TextField>, which will set states to its initial values, will fix this. But onSubmit handler must call it manually using a ref.
We have been porting the component on the v1-beta branch. We reimplemented it from the ground-up. While we haven't tested it, I think that the issue is most likely fixed on that branch. Hence, I'm closing it. Still, we will accept PR fixes until v1-beta takes over the master branch.
@oliviertassinari I don think the issue is still fixed. On submit of data , i'm calling event.target.reset() this is resetting the form but the labels are still floating.
@gauravsoni1 It's because React doesn't trigger any callback. The issue should be fixed on the React side. As far as I know.