From 7f19f2eed1d2218355d8ab8c09047a1389401715 Mon Sep 17 00:00:00 2001 From: 39zde Date: Thu, 10 Oct 2024 14:40:26 +0200 Subject: [PATCH] better keyboard support --- index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 8ae8850..b17a89f 100644 --- a/index.js +++ b/index.js @@ -35,7 +35,7 @@ function selectChildrenOf(parent, tagName) { */ function keyDownClicker(event) { event.preventDefault(); - if (event.key === "Enter") { + if (event.key === "Enter" || event.key === " ") { const inputElement = selectChildrenOf(event.target, "INPUT"); if (inputElement) { inputElement[0].click(); @@ -61,6 +61,7 @@ function keyDownClicker(event) { */ function cycler(selectElement) { const options = selectChildrenOf(selectElement, "OPTION"); + console.log(options) if (options && options.includes(selectElement.value)) { let index = options.indexOf(selectElement.value); if (index + 1 === options.length) {