From 227c41b5259d90cc5b286366fdd5fb8475ba7f6f Mon Sep 17 00:00:00 2001 From: Henrik Giesel Date: Sat, 26 Jun 2021 02:13:20 +0200 Subject: [PATCH] Minimize reflow upon clicking tag --- ts/editor/TagEditor.svelte | 1 + ts/editor/TagInput.svelte | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/ts/editor/TagEditor.svelte b/ts/editor/TagEditor.svelte index 88f6b0522..911585f3d 100644 --- a/ts/editor/TagEditor.svelte +++ b/ts/editor/TagEditor.svelte @@ -85,6 +85,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html async function moveToNextTag(index: number): Promise { if (index === tags.length - 1 || tags.length === 1) { focusNewInput(); + return; } tags[index].active = false; diff --git a/ts/editor/TagInput.svelte b/ts/editor/TagInput.svelte index 276fe35dd..9c9d61b97 100644 --- a/ts/editor/TagInput.svelte +++ b/ts/editor/TagInput.svelte @@ -149,6 +149,8 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html width: auto; grid-area: 1 / 1; font: inherit; + /* TODO we need something like --base-font-size for buttons' 13px */ + font-size: 13px; outline: none; border: none; margin: 0; @@ -157,8 +159,8 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html } &::after { - /* 8 spaces to minimize reflow on clicking tag */ - content: attr(data-value) " "; + /* 7 spaces to minimize reflow on clicking tag */ + content: attr(data-value) " "; visibility: hidden; white-space: pre-wrap; position: relative;