Skip to content

Commit

Permalink
Remove tab stop issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Danny Feliz committed Jul 13, 2017
1 parent aedcfbb commit fe05ff8
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 24 deletions.
2 changes: 0 additions & 2 deletions lib/Multiselect.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
@keydown.self.down.prevent="pointerForward()"
@keydown.self.up.prevent="pointerBackward()"
@keydown.enter.stop.prevent.self="addPointerElement()"
@keydown.tab.stop="addPointerElement()"
@keyup.esc="deactivate()"
class="multiselect">
<div @mousedown.prevent="toggle()" class="multiselect__select"></div>
Expand Down Expand Up @@ -45,7 +44,6 @@
@keyup.down="pointerForward()"
@keyup.up="pointerBackward()"
@keydown.enter.stop.prevent.self="addPointerElement()"
@keydown.tab.stop="addPointerElement()"
@keydown.delete="removeLastElement()"
class="multiselect__input"/>
<span
Expand Down
31 changes: 14 additions & 17 deletions lib/multiselectMixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ module.exports = {
return {
search: '',
isOpen: false,
value: this.selected ? deepClone(this.selected) : this.multiple ? [] : null
value: this.selected || this.selected === 0
? deepClone(this.selected)
: this.multiple ? [] : null
}
},
props: {
Expand Down Expand Up @@ -142,7 +144,6 @@ module.exports = {
customLabel: {
type: Function,
default (option, label) {
if (option && option.isTag) return option.label
return label ? option[label] : option
}
},
Expand Down Expand Up @@ -223,8 +224,7 @@ module.exports = {
: this.options
},
currentOptionLabel () {
const label = this.getOptionLabel(this.value)
return label ? label.toString() : ''
return this.getOptionLabel(this.value)
}
},
watch: {
Expand All @@ -238,11 +238,11 @@ module.exports = {
},
'search' () {
/* istanbul ignore else */
if (this.search !== this.currentOptionLabel) {
this.$emit('search-change', this.search, this.id)
}
if (this.search === this.currentOptionLabel) return

this.$emit('search-change', this.search, this.id)
},
'selected' (newVal, oldVal) {
'selected' () {
this.value = deepClone(this.selected)
}
},
Expand Down Expand Up @@ -287,19 +287,16 @@ module.exports = {
return !this.isSelected(option)
},
/**
* Returns the option[this.label]
* if option is Object. Otherwise check for option.label.
* If non is found, return entrie option.
*
* Returns empty string when options is null/undefined
* Returns tag query if option is tag.
* Returns the customLabel() results and casts it to string.
* @param {Object||String||Integer} Passed option
* @returns {Object||String}
*/
getOptionLabel (option) {
if (typeof option === 'object' && option !== null) {
return this.customLabel(option, this.label)
} else {
return option ? this.customLabel(option) : ''
}
if (!option && option !== 0) return ''
if (option.isTag) return option.label
return this.customLabel(option, this.label) + ''
},
/**
* Add the given option to the list of selected options
Expand Down
4 changes: 2 additions & 2 deletions lib/vue-multiselect.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/vue-multiselect.min.js.map

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions src/Multiselect.vue
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
@keydown.self.down.prevent="pointerForward()"
@keydown.self.up.prevent="pointerBackward()"
@keydown.enter.stop.prevent.self="addPointerElement()"
@keydown.tab.stop="addPointerElement()"
@keyup.esc="deactivate()"
class="multiselect">
<div @mousedown.prevent="toggle()" class="multiselect__select"></div>
Expand Down Expand Up @@ -45,7 +44,6 @@
@keyup.down="pointerForward()"
@keyup.up="pointerBackward()"
@keydown.enter.stop.prevent.self="addPointerElement()"
@keydown.tab.stop="addPointerElement()"
@keydown.delete="removeLastElement()"
class="multiselect__input"/>
<span
Expand Down

0 comments on commit fe05ff8

Please sign in to comment.