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 a724c53837
Signed by: darkwiiplayer
GPG key ID: 7808674088232B3E

View file

@ -191,7 +191,7 @@ export class BetterSelect extends HTMLElement {
}) })
this.addEventListener("keydown", event => { 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")) { if (this.#internals.states.has("--open")) {
this.close() this.close()
} else { } else {