mirror of https://github.com/sveltejs/svelte
[fix] dynamic autofocus (#6494)
parent
1e73482de6
commit
71c29bbf35
@ -1,8 +1,18 @@
|
|||||||
<script>
|
<script>
|
||||||
export let visible = false;
|
export let active = 'default';
|
||||||
let input;
|
export let autofocusFalse = false;
|
||||||
|
export let autofocusTrue = true;
|
||||||
|
let spread = { autofocus: true };
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if visible}
|
{#if active === 'default'}
|
||||||
<input bind:this={input} autofocus>
|
<input title={active} autofocus />
|
||||||
|
{:else if active === 'dynamic-false'}
|
||||||
|
<input title={active} autofocus={autofocusFalse} />
|
||||||
|
{:else if active === 'dynamic-true'}
|
||||||
|
<input title={active} autofocus={autofocusTrue} />
|
||||||
|
{:else if active === 'spread'}
|
||||||
|
<input title={active} {...spread} />
|
||||||
|
{:else if active === 'spread-override'}
|
||||||
|
<input title={active} {...spread} autofocus={false} />
|
||||||
{/if}
|
{/if}
|
Loading…
Reference in new issue