Children of text areas do not get rendered
ranile opened this issue · comments
Problem
textarea
s are allowed to have children (see MDN example). They are not rendered by Yew.
Steps To Reproduce
html! { <textarea>{"This is the default value"}</textarea> }
See playground
Expected behavior
The text area should have default value
Screenshots
If applicable, add screenshots to help explain your problem.
Environment:
- Yew version: 0.20
- Rust version: irrelevant
(also i forgot when playground was deployed) - Target, if relevant: [e.g.
wasm32-unknown-emscripten
]wasm32-unknown-unknown
- Build tool, if relevant: [e.g.
wasm-pack
,trunk
]trunk
- OS, if relevant: [e.g. MacOS]
Linux
- Browser and version, if relevant: [e.g. Chrome v83]
Questionnaire
- I'm interested in fixing this myself but don't know where to start
- I would like to fix and I have a solution
- I don't have time to fix this right now, but maybe later
Fix
VTagInner::TextArea
case should be handled here:
yew/packages/yew/src/virtual_dom/vtag.rs
Lines 289 to 300 in 40514a9
The fix should really be implemented after/alongside #3289 to avoid merge conflicts
If we allow children for textarea, should each render reconcile the content of textarea to be the text in the virtual dom?
The specification says children defines initial value, but wouldn't users expect this value to be updated as they provide a new VNode
for their component?
I feel it might be better to grant defaultvalue
a similar exception like value
and checked
to have it mapped to property
instead of attribute for default value. So users wouldn't try to update children of textarea and expect it to be updated.
i.e.: The following should work currently:
<textarea ~defaultValue="This is the default value" />
But maybe the following should also work:
<textarea defaultvalue="This is the default value" />