mirror of
https://gitlab.kit.edu/uskyk/typicalc.git
synced 2024-11-09 19:00:48 +00:00
Activate shortcuts only if possible
This commit is contained in:
parent
05885a4e6e
commit
c22c125b7b
@ -4,22 +4,26 @@ function handleKey(e) {
|
|||||||
if (e.target.tagName.toLowerCase() === "vaadin-text-field") {
|
if (e.target.tagName.toLowerCase() === "vaadin-text-field") {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
let element = null;
|
||||||
if (e.keyCode === 37) {
|
if (e.keyCode === 37) {
|
||||||
// left arrow
|
// left arrow
|
||||||
if (!e.ctrlKey) {
|
if (!e.ctrlKey) {
|
||||||
document.getElementById("previous-step").click();
|
element = document.getElementById("previous-step");
|
||||||
} else {
|
} else {
|
||||||
document.getElementById("first-step").click();
|
element = document.getElementById("first-step");
|
||||||
}
|
}
|
||||||
} else if (e.keyCode === 39) {
|
} else if (e.keyCode === 39) {
|
||||||
// right arrow
|
// right arrow
|
||||||
if (!e.ctrlKey) {
|
if (!e.ctrlKey) {
|
||||||
document.getElementById("next-step").click();
|
element = document.getElementById("next-step");
|
||||||
} else {
|
} else {
|
||||||
document.getElementById("last-step").click();
|
element = document.getElementById("last-step");
|
||||||
}
|
}
|
||||||
} else if (e.key === "/") {
|
} else if (e.key === "/") {
|
||||||
document.getElementById("inputField").focus();
|
document.getElementById("inputField").focus();
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
}
|
}
|
||||||
|
if (element !== null) {
|
||||||
|
element.click();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user