Only handle <space> when focus is on list

This commit is contained in:
Talia 2025-01-16 15:33:06 +01:00
parent 917b862786
commit aa93cee9fa
Signed by: darkwiiplayer
GPG key ID: 7808674088232B3E
2 changed files with 2 additions and 2 deletions

View file

@ -3,6 +3,6 @@
"browser": "src/BetterSelect.js",
"type": "module",
"license": "MIT",
"version": "1.2.1",
"version": "1.2.2",
"url": "https://darkwiiplayer.github.io/BetterSelect/"
}

View file

@ -191,7 +191,7 @@ export class BetterSelect extends HTMLElement {
})
this.addEventListener("keydown", event => {
if (event.key == " " && !this.input.contains(this.shadowRoot.activeElement)) {
if (event.key == " " && this.list.contains(this.shadowRoot.activeElement)) {
if (this.#internals.states.has("--open")) {
this.close()
} else {