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

Added a note on usage of textarea element #86

Closed
wants to merge 1 commit into from

Conversation

aleator
Copy link

@aleator aleator commented Oct 4, 2016

Maybe everyone else just knew about how to properly use textarea elements, but I spent half an hour trying the wrong way and got bit frustrated with them.

Setting the text area contents through child elements fails when the textarea elements are removed. Regardless of which element is removed, the content of the last text area vanishes and the remaining text areas get the previous contents in the original order. That is, the textarea contents jump from one element to another.

Maybe everyone else just knew about this, but I spent half an hour trying the wrong way and got frustrated.
@process-bot
Copy link

Thanks for the pull request! Make sure it satisfies this checklist. My human colleagues will appreciate it!

Here is what to expect next, and if anyone wants to comment, keep these things in mind.

@OvermindDL1
Copy link

Is there ever a good case to put child nodes in a textarea, or should that argument be entirely removed? I've never seen it done nor done it myself, and removing the List of Html children would prevent this error in the future. If someone really needed to attach children they could just call node "textarea" anyway as an advanced case.

@aleator
Copy link
Author

aleator commented Oct 6, 2016

I would recommend changing the textarea to omit the child nodes.
The spec says that "The textarea element represents a multiline plain text edit control. The contents of the control represent the control's default value." but in context of elm, I think the default value is better supplied in other ways.

@galtenberg
Copy link

This documentation is helpful (to me, found tonight), but it also potentially leads the user down the path of creating a worse experience when setting value reactively (the cursor will seem to not move as it gets updated with every key press - see #52).

Could align with the sentiment on https://github.com/elm-lang/html/issues/55#issuecomment-233513659 and suggest using defaultValue.

@aleator aleator closed this Dec 15, 2020
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.

5 participants