Skip to content

Commit

Permalink
Use rows attr for textarea height
Browse files Browse the repository at this point in the history
  • Loading branch information
nicoburns committed Dec 30, 2024
1 parent 1d78c3f commit 849d08a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/blitz-dom/src/layout/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,12 +136,17 @@ impl LayoutPartialTree for Document {

// TODO: deduplicate with single-line text input
if *element_data.name.local == *"textarea" {
let rows = element_data
.attr(local_name!("rows"))
.and_then(|val| val.parse::<f32>().ok())
.unwrap_or(2.0);

return compute_leaf_layout(
inputs,
&node.style,
|_known_size, _available_space| taffy::Size {
width: 300.0,
height: resolved_line_height.unwrap_or(16.0) * 4.0,
height: resolved_line_height.unwrap_or(16.0) * rows,
},
);
}
Expand Down

0 comments on commit 849d08a

Please sign in to comment.