ranile / material-yew

Yew wrapper for Material Web Components
https://material-yew.rm.rs
Apache License 2.0
230 stars 35 forks source link

Can't type in textarea or textfield unless max_length is specified. #5

Closed PepcyCh closed 3 years ago

PepcyCh commented 3 years ago

I tried to type something in textfields in the demo page and find that I can't type in anything unless max_length is specified. I also tried that on textareas and the same thing happened. After browsing the code, I find that it is because maxLength is always specified in mwc-textarea/mwc-textfield even max_length is not specified for MatTextArea/MatTextField and as a result, maxLength becomes 0 and I can't type in anything. This may be fixed by make max_length in TextAreaProps/TextFieldProps be Option<u64> and use maxLength=self.props.max_length.map(|v| Cow::from(v.to_string())) in view(), but old codes that use a &str to specify max_length have to be modified to be compilable, so I'm not sure if it is a good way to fix it.