2
0
mirror of https://github.com/tenrok/vue-select.git synced 2026-06-10 07:52:23 +03:00

fix(1735): use keypress event for space (#1736)

This commit is contained in:
Jeff Sagal
2022-12-17 13:39:49 -08:00
committed by GitHub
parent 6de1375690
commit 795feabcf7
3 changed files with 57 additions and 25 deletions
+12 -2
View File
@@ -574,8 +574,6 @@ export default {
default: () => [
// enter
13,
// space
32,
],
},
@@ -773,6 +771,7 @@ export default {
compositionstart: () => (this.isComposing = true),
compositionend: () => (this.isComposing = false),
keydown: this.onSearchKeyDown,
keypress: this.onSearchKeyPress,
blur: this.onSearchBlur,
focus: this.onSearchFocus,
input: (e) => (this.search = e.target.value),
@@ -1358,6 +1357,17 @@ export default {
return handlers[e.keyCode](e)
}
},
/**
* @todo: Probably want to add a mapKeyPress method just like we have for keydown.
* @param {KeyboardEvent} e
*/
onSearchKeyPress(e) {
if (!this.open && e.keyCode === 32) {
e.preventDefault()
this.open = true
}
},
},
}
</script>