Skip to content

Children of text areas do not get rendered #3296

@ranile

Description

@ranile

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.
image

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:

pub fn children(&self) -> &VList {
match &self.inner {
VTagInner::Other { children, .. } => children,
_ => {
// This is mutable because the VList is not Sync
static mut EMPTY: VList = VList::new();
// SAFETY: The EMPTY value is always read-only
unsafe { &EMPTY }
}
}
}

The fix should really be implemented after/alongside #3289 to avoid merge conflicts

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-yewArea: The main yew cratebug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions