Skip to content
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

[TextField] unable to specify inputClassName and apply props to input element #9508

Closed
kgregory opened this issue Dec 15, 2017 · 1 comment
Closed
Assignees
Labels
breaking change component: text field This is the name of the generic UI component, not the React module!

Comments

@kgregory
Copy link
Member

While answering a question on StackOverflow I ran into an issue:

In order to pass props to the input element via the TextField component, you need to specify an inputProps object within the InputProps property. This is fine, except for the fact that the current implementation of TextField sets its own value for inputProps so that the inputClassName is applied to the input element.

By handing your own value of inputProps to TextField, you will overwrite the value applied by TextField, leaving inputClassName unset.

As of today, the only way to use both is to include inputClassName in the inner inputProps object.

Expected Behavior

inputClassName should be applied to the input element whether InputProps includes inputProps or not. The one exception would be if the inner inputProps includes a className prop as well.

Current Behavior

If you specify inputClassName and include inputProps within InputProps, the class will not be applied to the input element.

Steps to Reproduce (for bugs)

See this codesandbox for a reproduction of this issue

@kgregory kgregory self-assigned this Dec 15, 2017
@kgregory kgregory added bug 🐛 Something doesn't work v1.x labels Dec 15, 2017
@oliviertassinari oliviertassinari added docs Improvements or additions to the documentation and removed bug 🐛 Something doesn't work v1.x labels Dec 15, 2017
@oliviertassinari
Copy link
Member

oliviertassinari commented Dec 15, 2017

It's related to #9326. cc @rosskevin

@oliviertassinari oliviertassinari added breaking change component: text field This is the name of the generic UI component, not the React module! and removed docs Improvements or additions to the documentation labels Dec 15, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking change component: text field This is the name of the generic UI component, not the React module!
Projects
None yet
Development

No branches or pull requests

2 participants