Skip to content

Commit

Permalink
fix(VSelect): cannot select items with value '0' with keyboard
Browse files Browse the repository at this point in the history
fix(VSelect): items with value 0 not included in counter
  • Loading branch information
ERPedersen committed Jun 15, 2022
1 parent 0243af8 commit 766771b
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions packages/vuetify/src/components/VSelect/VSelect.ts
Expand Up @@ -155,15 +155,16 @@ export default baseMixins.extend<options>().extend({
return `list-${this._uid}`
},
computedCounterValue (): number {
const value = this.multiple
? this.selectedItems
: (this.getText(this.selectedItems[0]) || '').toString()
let value

if (typeof this.counterValue === 'function') {
return this.counterValue(value)
if (this.multiple) {
value = this.selectedItems
} else {
const text = this.getText(this.selectedItems[0])
value = (text || text === 0 ? text : '').toString()
}

return value.length
return typeof this.counterValue === 'function' ? this.counterValue(value) : value.length
},
directives (): VNodeDirective[] | undefined {
return this.isFocused ? [{
Expand Down Expand Up @@ -650,7 +651,8 @@ export default baseMixins.extend<options>().extend({
this.keyboardLookupLastTime = now

const index = this.allItems.findIndex(item => {
const text = (this.getText(item) || '').toString()
const value = this.getText(item)
const text = (value || value === 0 ? value : '').toString()

return text.toLowerCase().startsWith(this.keyboardLookupPrefix)
})
Expand Down

0 comments on commit 766771b

Please sign in to comment.