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

Html textarea does not accept value property #25

Closed
frycz opened this issue Jun 22, 2020 · 9 comments
Closed

Html textarea does not accept value property #25

frycz opened this issue Jun 22, 2020 · 9 comments

Comments

@frycz
Copy link

frycz commented Jun 22, 2020

About

Html textarea properties (source: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/textarea), value is not a valid one:

autocapitalize

Note: This [autocapitalize] is a non-standard attribute supported by WebKit on iOS (therefore nearly all browsers running on iOS, including Safari, Firefox, and Chrome), which controls whether and how the text value should be automatically capitalized as it is entered/edited by the user. The non-deprecated values are available in iOS 5 and later

autocomplete
autofocus
cols
disabled
form
maxlength
minlength
name
placeholder
readonly
required
rows
spellcheck
wrap

textarea also accepts global attributes: https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes.

Possible solution

The correct attributes need to be added here https://github.com/Thomazella/react-known-props/blob/90885fbbcdac6eb4b88f74e195f8a8b48fbc1e0f/src/generated/reactHtmlElementsToPropsMap.js#L309-L331

@tcodes0
Copy link
Owner

tcodes0 commented Jun 22, 2020

so the correct attributes would be:

autocomplete
autofocus
cols
disabled
form
maxlength
minlength
name
placeholder
readonly
required
rows
spellcheck
wrap

plus global attributes?

@diegohaz
Copy link
Collaborator

value is actually a valid prop on React textarea elements: https://reactjs.org/docs/forms.html#the-textarea-tag

@frycz
Copy link
Author

frycz commented Jun 22, 2020

Yes it is. Does this map https://github.com/Thomazella/react-known-props/blob/master/src/generated/reactHtmlElementsToPropsMap.js contain HTML attributes or react properties?

@tcodes0
Copy link
Owner

tcodes0 commented Jun 22, 2020

both I think. Goal here was to have all props react recognizes

@frycz
Copy link
Author

frycz commented Jun 22, 2020

Ok, I reported the issue as we use your getElementProps function, which according to the docs returns "all props valid on the HTML/SVG element provided as an argument, plus all ARIA props, including role. Doesn't include event props".

Result of getElementProps('textarea') contains value which isn't valid HTML attribute but is accepted by React element. A question is if this is the intention of the function.

@tcodes0
Copy link
Owner

tcodes0 commented Jun 23, 2020

I think so, we've been using this lib with react. Are you saying that for your use case you'd rather only have valid HTML attributes?

@frycz
Copy link
Author

frycz commented Jun 23, 2020

Yea, this is what we expected. Anyway, we still use your lib with a small workaround. If getElementProps purpose is to give props accepted by React element then we are good, I thought that this is an error.

@tcodes0
Copy link
Owner

tcodes0 commented Jun 23, 2020

Maybe we should update docs at least, thoughts? or maybe rename the function, add jsdoc comments 🤔

@diegohaz
Copy link
Collaborator

I think the name of the library is enough. It's react-known-props. Can't be more descriptive. But if it causes confusion, emphasizing this in the readme is a good idea.

@tcodes0 tcodes0 closed this as completed in bd48119 Jul 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants