Make sure form is not submitted when using typeahead.
--- a/src_js/iconolab-bundle/src/components/tagform/TagListItem.vue Mon Feb 27 18:19:32 2017 +0100
+++ b/src_js/iconolab-bundle/src/components/tagform/TagListItem.vue Mon Feb 27 19:08:52 2017 +0100
@@ -4,15 +4,15 @@
<span class="tag-title">{{ label }}</span>
<div class="tag-item-buttons">
<div class="tag-item-btn tag-item-accuracy" v-bind:data-value="accuracy">
- <button class="btn btn-default" v-bind:title="accuracyTitle">{{ accuracy || '?' }}</button>
+ <button type="button" class="btn btn-default" v-bind:title="accuracyTitle">{{ accuracy || '?' }}</button>
<i v-if="index === 0" class="fa fa-exclamation-triangle text-muted" aria-hidden="true" title="Fiabilité"></i>
</div>
<div class="tag-item-btn tag-item-relevancy" v-bind:data-value="relevancy">
- <button class="btn btn-default" v-bind:title="relevancyTitle">{{ relevancy || '?' }}</button>
+ <button type="button" class="btn btn-default" v-bind:title="relevancyTitle">{{ relevancy || '?' }}</button>
<i v-if="index === 0" class="fa fa-crosshairs text-muted" aria-hidden="true" title="Pertinence"></i>
</div>
<div v-show="!readonly" class="tag-item-btn tag-item-delete">
- <button class="btn btn-default" @click="remove"><i class="fa fa-times" aria-hidden="true"></i></button>
+ <button type="button" class="btn btn-default" @click="remove"><i class="fa fa-times" aria-hidden="true"></i></button>
</div>
</div>
</div>
--- a/src_js/iconolab-bundle/src/components/tagform/Typeahead.vue Mon Feb 27 18:19:32 2017 +0100
+++ b/src_js/iconolab-bundle/src/components/tagform/Typeahead.vue Mon Feb 27 19:08:52 2017 +0100
@@ -6,6 +6,7 @@
v-bind:placeholder="placeholder"
autocomplete="off"
v-model="query"
+ @keypress.enter="preventSubmit"
@keydown.down="down"
@keydown.up="up"
@keydown.enter="hit($event)"
@@ -163,6 +164,10 @@
if (!selected) { return; }
this.$emit('selected', selected);
this.reset();
+ },
+ preventSubmit(e) {
+ e.preventDefault();
+ e.stopPropagation();
}
}