TheComputerM / svelte-materialify

A Material UI Design Component library for Svelte heavily inspired by vuetify.
https://svelte-materialify.vercel.app
MIT License
622 stars 83 forks source link

Textarea Label issue #247

Closed GrochowskiC closed 3 years ago

GrochowskiC commented 3 years ago

class active is not applied on label because the labelActive variable is not reactive. should have : $: labelActive = !!placeholder || value; instead of : let labelActive = !!placeholder || value;

V-ed commented 3 years ago

It's supposed to be updated through these methods no?

https://github.com/TheComputerM/svelte-materialify/blob/02cf91ee9028abeb4dcfbb3ae6829c1892533e7c/packages/svelte-materialify/src/components/Textarea/Textarea.svelte#L44-L56

GrochowskiC commented 3 years ago

No. If the value is updated after initialization, by async data for example, labelActive will stay to false. And to be consistent with the TextField component, you should use $: (Also, to be consistent with TextField, use export validate() instead of checkRules and return error !)

V-ed commented 3 years ago

Ah, true, I see what you mean now

Example REPL : https://svelte.dev/repl/1154fe4b3434494b88c2e1cf35960c76?version=3.38.1

(notice how the label doesn't shift up as the "test" string value gets updated)