fix prevent default keybindings

This commit is contained in:
Philipp Kühn 2018-09-27 18:50:29 +02:00
parent bf83cabafe
commit ba2be37f0f

View File

@ -63,36 +63,35 @@ export default {
}, },
], ],
onEnter: args => { onEnter: args => {
console.log('start', args)
this.query = args.query this.query = args.query
this.filteredUsers = args.items this.filteredUsers = args.items
}, },
onChange: args => { onChange: args => {
console.log('change', args)
this.query = args.query this.query = args.query
this.filteredUsers = args.items this.filteredUsers = args.items
}, },
onExit: args => { onExit: args => {
console.log('stop', args)
this.query = null this.query = null
this.filteredUsers = args.items this.filteredUsers = args.items
}, },
onKeyDown: ({ event }) => { onKeyDown: ({ event }) => {
// pressing up arrow // pressing up arrow
if (event.keyCode === 38) { if (event.keyCode === 38) {
event.preventDefault()
this.upHandler() this.upHandler()
return true
} }
// pressing down arrow // pressing down arrow
if (event.keyCode === 40) { if (event.keyCode === 40) {
event.preventDefault()
this.downHandler() this.downHandler()
return true
} }
// pressing enter // pressing enter
if (event.keyCode === 13) { if (event.keyCode === 13) {
event.preventDefault()
this.enterHandler() this.enterHandler()
return true
} }
return false
}, },
onFilter: (items, query) => { onFilter: (items, query) => {
if (!query) { if (!query) {