[Bug] Tag text changes on selection in specific scenario

When selecting previous/next tag with keyboard, newly-editing tag text changes to previous tag if the previously-editing tag name is normalized by normalizeTagname on blur.

Screen Recording 2022-05-09 at 10.12.52 AM

How to reproduce

  1. Go to Add notes
  2. Create tag “a” in tags field
  3. Write new tag “b::”
  4. Select previous tag using left arrow key
    => tag “a” changes to “b”

Debugging

It’s weird because activeName is changed properly to “b”. If you add $: console.log("activeName", activeName) to tagEditor.svelte and $: console.log("name", name) to tagInput.svelte, you can see that even though activeName is set to “b”, name isn’t changed. (name is bound to activeName with bind:name={activeName})