Adjust position so tags do not even move a single pixel when going into editing

This commit is contained in:
Henrik Giesel 2021-07-01 22:58:28 +02:00
parent 6642a11482
commit 9499bc1505
3 changed files with 51 additions and 47 deletions

View file

@ -54,7 +54,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
<svelte:body on:keydown={setDeleteIcon} on:keyup={setDeleteIcon} /> <svelte:body on:keydown={setDeleteIcon} on:keyup={setDeleteIcon} />
<button <button
class={`tag btn d-inline-flex align-items-center text-nowrap rounded ps-2 pe-1 ${className}`} class={`tag btn d-inline-flex align-items-center text-nowrap rounded ps-2 pe-1 m-0 ${className}`}
class:selected class:selected
class:flashing class:flashing
class:select-mode={selectMode} class:select-mode={selectMode}

View file

@ -362,7 +362,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
{size} {size}
on:focusout={deselectIfLeave} on:focusout={deselectIfLeave}
> >
<div class="pad" on:mousedown|preventDefault> <div class="gap" on:mousedown|preventDefault>
{#if tags.some((tag) => tag.selected)} {#if tags.some((tag) => tag.selected)}
<SelectedTagBadge <SelectedTagBadge
on:tagcopy={copySelectedTags} on:tagcopy={copySelectedTags}
@ -374,7 +374,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
</div> </div>
{#each tags as tag, index (tag.id)} {#each tags as tag, index (tag.id)}
<div class="position-relative pad" class:hide-tag={index === active}> <div class="position-relative gap" class:hide-tag={index === active}>
<Tag <Tag
class="me-1" class="me-1"
name={tag.name} name={tag.name}
@ -393,6 +393,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
/> />
{#if index === active} {#if index === active}
<div class="adjust-position">
<WithAutocomplete <WithAutocomplete
class="d-flex flex-column-reverse dropup" class="d-flex flex-column-reverse dropup"
{suggestionsPromise} {suggestionsPromise}
@ -404,7 +405,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
> >
<TagInput <TagInput
id={tag.id} id={tag.id}
class="position-absolute top-0 start-0" class="tag-input position-absolute top-0 start-0 ps-2 py-0"
bind:name={activeName} bind:name={activeName}
bind:input={activeInput} bind:input={activeInput}
on:focus={() => { on:focus={() => {
@ -432,6 +433,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
}} }}
/> />
</WithAutocomplete> </WithAutocomplete>
</div>
{/if} {/if}
</div> </div>
{/each} {/each}
@ -452,7 +454,12 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
opacity: 0; opacity: 0;
} }
.pad { .gap {
padding-bottom: 0.15rem; margin-bottom: 0.15rem;
}
.adjust-position :global(.tag-input) {
/* recreates positioning of Tag component */
border-left: 1px solid transparent;
} }
</style> </style>

View file

@ -192,9 +192,6 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
<style lang="scss"> <style lang="scss">
input { input {
padding-left: 9.5px;
padding-bottom: 5.5px;
width: 100%; width: 100%;
height: 100%; height: 100%;