Prevent initial space when opening with space bar
This commit is contained in:
parent
df795fe894
commit
3f7d435fff
2 changed files with 3 additions and 2 deletions
|
@ -3,6 +3,6 @@
|
||||||
"browser": "src/BetterSelect.js",
|
"browser": "src/BetterSelect.js",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"version": "1.3.0",
|
"version": "1.3.1",
|
||||||
"url": "https://darkwiiplayer.github.io/BetterSelect/"
|
"url": "https://darkwiiplayer.github.io/BetterSelect/"
|
||||||
}
|
}
|
||||||
|
|
|
@ -203,6 +203,8 @@ export class BetterSelect extends HTMLElement {
|
||||||
} else {
|
} else {
|
||||||
if (key == " ") {
|
if (key == " ") {
|
||||||
this.open()
|
this.open()
|
||||||
|
event.preventDefault()
|
||||||
|
event.stopPropagation()
|
||||||
} else if (key == "Escape") {
|
} else if (key == "Escape") {
|
||||||
this.keyboardSearchBuffer = ""
|
this.keyboardSearchBuffer = ""
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
|
@ -236,7 +238,6 @@ export class BetterSelect extends HTMLElement {
|
||||||
|
|
||||||
const timeout = 1000 * (Number(this.getAttribute("search-timeout")) || 1)
|
const timeout = 1000 * (Number(this.getAttribute("search-timeout")) || 1)
|
||||||
const ref = setTimeout(()=> {
|
const ref = setTimeout(()=> {
|
||||||
console.warn("Clearing buffer: " + this.keyboardSearchBuffer)
|
|
||||||
this.keyboardSearchBuffer = ""
|
this.keyboardSearchBuffer = ""
|
||||||
}, timeout)
|
}, timeout)
|
||||||
this.searchTimeout.signal.addEventListener("abort", () => {
|
this.searchTimeout.signal.addEventListener("abort", () => {
|
||||||
|
|
Loading…
Reference in a new issue