erikras / redux-form-material-ui

A set of wrapper components to facilitate using Material UI with Redux Form
http://erikras.github.io/redux-form-material-ui/
MIT License
831 stars 227 forks source link

Autocomplete does not pass the "name" attribute to the input #136

Open VasilyShelkov opened 7 years ago

VasilyShelkov commented 7 years ago

Hey, great library,

Problem just noticed that the autocomplete has lost the name attribute on the since redux-form-material-ui v4.1.4.

Have not had time to investigate why but if you look at the library's live demo and inspect the autocomplete components they don't have the name attribute.

Temporary Fix after npm installing v4.1.3 of redux-form-material-ui the name attribute in the Autocomplete input is there as expected.

Reason why important The only reason I caught this and also need it is because I have selenium integration/feature tests that use the name of the input to fill in the fields automatically

erikras commented 7 years ago

This is not passed because the AutoComplete component doesn't take a name prop.

VasilyShelkov commented 7 years ago

While that is the case @erikras, it didn't ever take a prop called name but if that was a problem then why does an earlier version(4.1.3) of redux-form-material-ui where the underlying Autocomplete input have the name prop? Material-UI didn't have the name prop for the Autocomplete in earlier versions as far as I'm aware.

Redux-Form fields I think should always have a name attribute, I know it technically adds complexity to this library because it is extra functionality but at least it will stay consistent. Not only this but for people who have browser-driven tests, it makes it easy to fill in the fields created by this library.

An example about my point of consistency:

erikras commented 7 years ago

This library was causing several warnings from MUI about props that were going to be deprecated soon, so I went through and culled all the props that were not specifically in the MUI docs. Redux Form provides a bunch of stuff, e.g. onFocus, onDrop, etc. that MUI doesn't want or need. It was just housekeeping to better align the APIs.

That said, name seems like a pretty innocuous one to pass for all inputs, so I think we should add it back.

advance512 commented 7 years ago

I get the following warning with redux-form-material-ui@4.2.0:

Warning: Material-UI: We don't have enough information
      to build a robust unique id for the TextField component. Please provide an id or a name.
warning @ browser.js:49
componentWillMount @ TextField.js:243
(anonymous) @ ReactCompositeComponent.js:348
..
..

This comes from an AutoComplete component. Related?

advance512 commented 7 years ago

So, yeah, the AutoComplete component doesn't take a name prop - but apparently it transparently passes most props to the contained TextField, including the name.