hperrin / svelte-material-ui

Svelte Material UI Components
https://sveltematerialui.com/
Apache License 2.0
3.28k stars 288 forks source link

FloatingLabel's float method doesn't stop label floating in Textfield #571

Open FeedMyCat54 opened 1 year ago

FeedMyCat54 commented 1 year ago

Describe the bug FloatingLabel.float(false); does not make the label stop floating.

To Reproduce Steps to reproduce the behavior:

  1. Add a Textfield with a value and a bind for the label.
  2. Inside the onMount() function call the float method with false as a parameter.
  3. Click inside the Textfield.
  4. label still floats to the top left.

Expected behavior When I click on the Textfield the label does not float.

Desktop

Additional context Sample code:

<Textfield
    variant="filled"   
    label="label"
    bind:floatingLabel={floatingLabel1}
>  </Textfield>

<script lang="ts">
    import Textfield from '@smui/textfield';
    import type FloatingLabel from '@smui/floating-label/src/FloatingLabel.svelte';
    import { onMount } from 'svelte';

    let floatingLabel1: FloatingLabel;

    onMount(() => {
        floatingLabel1.float(false);
        })
</script>