Skip to content

Commit

Permalink
fix selection method
Browse files Browse the repository at this point in the history
  • Loading branch information
39zde committed Oct 10, 2024
1 parent 79cb9ad commit 5b6d8c8
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,13 @@ function checkBrowserCompatibility() {
function keyDownClicker(event) {
event.preventDefault();
if (event.key === "Enter") {
let labelElement = event.target;
let inputElement = labelElement.queySelector("input");
console.log(labelElement);
console.log(inputElement);
let inputElement;
for (const elem of event.target.children) {
if (elem.tagName === "INPUT") {
inputElement = elem;
break;
}
}
if (inputElement) {
inputElement.click();
} else {
Expand Down Expand Up @@ -69,7 +72,13 @@ function cycler(selectElement) {
function keyDownCycler(event) {
event.preventDefault();
if (event.key === "Enter") {
let selectElement = event.target.queySelector("select");
let selectElement;
for (const elem of event.target.children) {
if (elem.tagName === "SELECT") {
selectElement = elem;
break;
}
}
if (selectElement) {
cycler(selectElement);
} else {
Expand Down

0 comments on commit 5b6d8c8

Please sign in to comment.