Skip to content

fix #16 missing documentation: null/undefined as input value #35

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

Merged
merged 5 commits into from
Oct 7, 2017
Merged

fix #16 missing documentation: null/undefined as input value #35

merged 5 commits into from
Oct 7, 2017

Conversation

fanny
Copy link

@fanny fanny commented Oct 6, 2017

No description provided.

@reactjs-bot
Copy link

reactjs-bot commented Oct 6, 2017

Deploy preview ready!

Built with commit 5a084dd

https://deploy-preview-35--reactjs.netlify.com

@bvaughn
Copy link
Contributor

bvaughn commented Oct 6, 2017

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need the corporate CLA signed.

If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks!

@fanny
Copy link
Author

fanny commented Oct 7, 2017

sorry for the inconvenience, I already registered

@bvaughn
Copy link
Contributor

bvaughn commented Oct 7, 2017

No worries! Thanks for confirming. 😄

(Sorry for the awkwardness here. I'm still getting the new repo setup. Normally this comment is automated.)

Copy link
Contributor

@bvaughn bvaughn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is subjective, but I think this content would be better as a subsection of docs/forms.html (under the "Controlled Components" header) rather than a standalone page.

I think we could redirect /tips/controlled-input-null-value.html (mentioned in #16) directly to this new subsection using the _redirects file. I haven't tried this but I think we could do it with a new rule like so:

/tips/controlled-input-null-value.html  /docs/forms.html#anchortaghere

(Where #anchortaghere matches whatever section header we use.)

permalink: docs/controlled-input-null-value.html
---

Specifying the value prop on a [controlled component](/docs/forms.html) prevents the user from changing the input unless you desire so.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably link to /docs/forms.html#controlled-components


You might have run into a problem where value is specified, but the input can still be changed without consent. In this case, you might have accidentally set value to undefined or null.

For example, this code shows this phenomenon; after a second, the text becomes editable.
Copy link
Contributor

@bvaughn bvaughn Oct 7, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Grammatical nit: There's a lot of unnecessary commas in this content. Maybe we could change it something like?

You might have encountered a situation where value is specified but an input is still editable. In this case you might have accidentally set value to undefined or null.

The following code demonstrates this. (The input becomes editable after a short delay.)

@fanny
Copy link
Author

fanny commented Oct 7, 2017

Thanks, I'll make the necessary changes. 👍

@fanny
Copy link
Author

fanny commented Oct 7, 2017

I noticed that this redirect rule
/tips/controlled-input-null-value.html /docs/forms.html#anchortaghere
can not redirect to a specific topic on the page

@bvaughn
Copy link
Contributor

bvaughn commented Oct 7, 2017

I noticed that this redirect rule
/tips/controlled-input-null-value.html /docs/forms.html#anchortaghere
can not redirect to a specific topic on the page

It should, so long as the anchor tag actually matches one on the page 😄

Copy link
Contributor

@bvaughn bvaughn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for contributing!

@bvaughn bvaughn merged commit c862fbf into reactjs:master Oct 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants