petites améliorations

This commit is contained in:
2025-04-24 21:41:50 +02:00
parent e234dd0ff8
commit 65e31d71c6
4 changed files with 18 additions and 9 deletions

View File

@ -19,20 +19,26 @@ inputs.forEach(input => {
};
input.onkeydown = function (event) {
next_input = null;
switch (event.key) {
case 'ArrowUp':
inputs[(input.index - largeur + nb_cases) % nb_cases].focus();
next_input = inputs[(input.index - largeur + nb_cases) % nb_cases];
break;
case 'ArrowDown':
inputs[(input.index + largeur) % nb_cases].focus();
next_input = inputs[(input.index + largeur) % nb_cases];
break;
case 'ArrowLeft':
inputs[(input.index - 1 + nb_cases) % nb_cases].focus();
next_input = inputs[(input.index - 1 + nb_cases) % nb_cases];
break;
case 'ArrowRight':
inputs[(input.index + 1) % nb_cases].focus();
next_input = inputs[(input.index + 1) % nb_cases];
break;
}
if (next_input) {
next_input.focus();
next_input.select();
event.preventDefault();
}
};
input.oninput = function (event) {