Closed GrochowskiC closed 3 years ago
It's supposed to be updated through these methods no?
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 !)
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)
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;