Skip to content

Commit

Permalink
add shift Tab support
Browse files Browse the repository at this point in the history
  • Loading branch information
39zde committed Oct 10, 2024
1 parent c733435 commit cbbe051
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,14 @@ function keyDownClicker(event) {
throw new Error(`Failed to find input-element`);
}
} else if (event.key === "Tab") {
if (event.target.nextElementSibling !== null) {
event.target.nextElementSibling.focus();
if (event.shiftKey) {
if (event.target.previousElementSibling !== null) {
event.target.previousElementSibling.focus();
}
} else {
if (event.target.nextElementSibling !== null) {
event.target.nextElementSibling.focus();
}
}
}
}
Expand Down Expand Up @@ -68,8 +74,14 @@ function keyDownCycler(event) {
throw new Error(`Failed to find select-element`);
}
} else if (event.key === "Tab") {
if (event.target.nextElementSibling !== null) {
event.target.nextElementSibling.focus();
if (event.shiftKey) {
if (event.target.previousElementSibling !== null) {
event.target.previousElementSibling.focus();
}
} else {
if (event.target.nextElementSibling !== null) {
event.target.nextElementSibling.focus();
}
}
}
}
Expand Down

0 comments on commit cbbe051

Please sign in to comment.