diff --git a/ts/tag-editor/TagEditor.svelte b/ts/tag-editor/TagEditor.svelte index 30e50ebc7..40c950040 100644 --- a/ts/tag-editor/TagEditor.svelte +++ b/ts/tag-editor/TagEditor.svelte @@ -125,15 +125,15 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html export function appendEmptyTag(): void { // used by tag badge and tag spacer deselect(); - const tagsHadFocus = active === null; - active = null; - const lastTag = tagTypes[tagTypes.length - 1]; if (!lastTag || lastTag.name.length > 0) { appendTagAndFocusAt(tagTypes.length - 1, ""); } + const tagsHadFocus = active === null; + active = null; + if (tagsHadFocus) { decideNextActive(); } @@ -163,11 +163,11 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html const splitOff = activeName.slice(end); activeName = current; - active = null; // await tag to update its name, so it can normalize correctly await tick(); appendTagAndFocusAt(index, splitOff); + active = null; await tick(); if (index === active) { @@ -292,6 +292,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html break; case "Enter": + autocomplete.chooseSelected(); event.preventDefault(); break; }