diff --git a/ts/editor/TagEditor.svelte b/ts/editor/TagEditor.svelte index cdaae15fb..051598b91 100644 --- a/ts/editor/TagEditor.svelte +++ b/ts/editor/TagEditor.svelte @@ -231,15 +231,24 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html activeAfterBlur = null; } + function printableKey(event: KeyboardEvent): boolean { + return ( + (event.location === KeyboardEvent.DOM_KEY_LOCATION_STANDARD || + event.location === KeyboardEvent.DOM_KEY_LOCATION_NUMPAD) && + !event.code.startsWith("Arrow") + ); + } + function update(event: KeyboardEvent, autocomplete: any): void { const visible = autocomplete.isVisible(); + const printable = printableKey(event); - if ( - !visible && - (event.location === KeyboardEvent.DOM_KEY_LOCATION_STANDARD || - event.location === KeyboardEvent.DOM_KEY_LOCATION_NUMPAD) - ) { - autocomplete.show(); + if (!visible) { + if (printable) { + autocomplete.show(); + } else { + return; + } } switch (event.code) { @@ -269,7 +278,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html break; default: - if (event.code.startsWith("Arrow")) { + if (!printable) { return; } @@ -280,11 +289,13 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html - - + + + - {#each tags as tag, index (tag.id)} + {#each tags as tag, index (tag.id)} + {#if index === active} {/if} - {/each} + + {/each} - - {active} - {activeAfterBlur} - - + + {active} + {activeAfterBlur} +