Skip to content

Commit

Permalink
feat: focus tags input box (#6392)
Browse files Browse the repository at this point in the history
  • Loading branch information
jsawo committed Nov 27, 2022
1 parent dbe4603 commit 2d75053
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions resources/js/components/people/Tags.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,16 @@

<!-- edit button -->
<li v-show="contactTags.length > 0" class="di">
<a v-show="!editMode" class="pointer" href="" @click.prevent="search = ''; editMode = true">
<a v-show="!editMode" class="pointer" href="" @click.prevent="enterEditMode">
{{ $t('app.edit') }}
</a>
</li>

<!-- add a new tag -->
<li v-show="editMode" class="di mb3">
<div class="relative di mr2">
<input v-model="search"
<input ref="tags"
v-model="search"
type="text"
class="di br2 f5 ba b--black-40 pa2 outline-0"
:placeholder="$t('people.tag_add_search')"
Expand All @@ -66,7 +67,7 @@
</ul>
</div>

<a class="pointer" href="" @click.prevent="editMode = false">
<a class="pointer" href="" @click.prevent="search = ''; editMode = false; isOpen = false;">
{{ $t('app.close') }}
</a>
</li>
Expand All @@ -76,7 +77,7 @@
<span class="i mr2">
{{ $t('people.tag_no_tags') }}
</span>
<a v-show="!editMode" class="pointer" href="" @click.prevent="editMode = true">
<a v-show="!editMode" class="pointer" href="" @click.prevent="enterEditMode">
{{ $t('people.tag_add') }}
</a>
</li>
Expand Down Expand Up @@ -143,6 +144,11 @@ export default {
});
},
enterEditMode() {
this.editMode = true;
this.$nextTick(() => this.$refs.tags.focus());
},
removeTag(tag) {
this.contactTags.splice(this.contactTags.indexOf(tag), 1);
this.store();
Expand Down

0 comments on commit 2d75053

Please sign in to comment.