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] attributes propagation #6467

Closed
novembrea opened this issue Mar 30, 2017 · 5 comments · Fixed by #6469
Closed

[TextField] attributes propagation #6467

novembrea opened this issue Mar 30, 2017 · 5 comments · Fixed by #6469
Labels
component: text field This is the name of the generic UI component, not the React module! support: question Community support but can be turned into an improvement

Comments

@novembrea
Copy link
Contributor

In the @next release TextField component does not propagate props to an actual input element, it defines them on the outermost wrapper div instead. I.e,
<TextField name="email" /> will result in <div name="email">{...}</div>

This renders following snippet unusable.

handleChange = e => {
  this.setState({ [e.target.name]: e.target.value });
}

I would like to clarify whether this is intended approach. Right now I work around by passing identifier explicitly, onChange={e => this.handleChange(e, 'email')} but this feels a bit excessively since name attribute aims to facilitate this exact task.
Thank you for your time, next release looks absolutely stunning.

@oliviertassinari
Copy link
Member

You are right, the properties aren't forwarded to a native input but to the FormControl component. You have two options:

  • Use the FormControl and Input component on userland.
  • Use the inputProps property

Here are the rules behind our API. That might change, feel free to make your case. I'm closing the issue for now.

@oliviertassinari oliviertassinari added component: text field This is the name of the generic UI component, not the React module! next support: question Community support but can be turned into an improvement labels Mar 30, 2017
@oliviertassinari oliviertassinari changed the title @next [TextField] attributes propagation [TextField] attributes propagation Mar 30, 2017
@oliviertassinari
Copy link
Member

Actually, forwarding the name property sounds like a good use case. I'm reopening. Do you want to make a PR for that?

@novembrea
Copy link
Contributor Author

Sure I'd be glad to contribute.

@agamrafaeli
Copy link
Contributor

This should be closed thanks to #6469

@oliviertassinari
Copy link
Member

You are right, thanks for the reminder.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: text field This is the name of the generic UI component, not the React module! support: question Community support but can be turned into an improvement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants