-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Closed
Labels
Description
Describe the bug
AFAIK, it is bad for a11y & performance if you destroy then attach a new form element if you just want to change the text label of said element. If you keep the same form element around, the tab focus doesn't get lost.
Even the on:click function stays the same in the example.
Reproduction
https://svelte.dev/tutorial/else-blocks
{#if user.loggedIn}
<button on:click={toggle}>
Log out
</button>
{:else}
<button on:click={toggle}>
Log in
</button>
{/if}vs my proposed
<button on:click={toggle}>
{#if user.loggedIn}
Log out
{:else}
Log in
{/if}
</button>Severity
annoyance