-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
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
Provide a way to set properties on the native input element rendered by TextField #11427
Comments
@NonPolynomial I don't understand. How would you do that with a native React element? How is this issue specific to Material-UI? |
@oliviertassinari
I currently use a workaround and save my data with the usage of How I said, the naming / API is missleading.
I'm currently not sure if this is a bug report or a feature request. If this is not a bug and is intentionally implemented that way, than the documentation has to be updated to clearify the behavior. |
@NonPolynomial Updating the documentation to use the "attribute" wording intead of "property" sounds good to me 👍. Going back to your problem, you can do: <TextField inputRef={(elem) => { elem.myData = { foo: 'bar' }; }} /> |
hey @oliviertassinari , I already use Maybe, there should be a notice about the difference between properties and attributes.
If you wish, I could do the changes and make a PR. I can provide a list of occurences where I did a list of occurences for inputProps with the context of native input elements: |
Hey @NonPolynomial are you doing this? |
Is anyone working on this? |
@oliviertassinari can I work on this? |
@adeelibr Got a lot to work last weeks, so i couldn't do it myself. |
It's not really misleading, because in the React world you pass It's jQuery's I don't think anything should happen here. Maybe a note in the documentation somewhere explaining it a bit and providing this as an example:
|
@uvtzxpm It's a fair point. I'm happy either way. |
Sorry for the late response, I was busy with my office work. I read the thread and made a small PR as suggested. Is this how I was suppose to do it #11694 @oliviertassinari |
@uvtzxpm normally you would be right, but the documentation as it is, says |
Expected Behavior
Properties passed per
inputProps
to aTextField
should add properties to the nativeinput
element.Current Behavior
The native input element get an
attribute
instead of anproperty
.Steps to Reproduce (for bugs)
Example Link on CodeSandbox
TextField
inputProps
input
elementContext
I have to use a third-party-library and wanted to save an object on the native
input
element, which contains further information about the input field (why it is rendered and how it should be validated)Your Environment
Dependencies from
package.json
:Tested in Chrome.
the naming of
inputProps
is highly missleading, because it is just rendering attributes and not properties as the naming says.The text was updated successfully, but these errors were encountered: