feat: add arrow key navigation to calculator sample

This commit is contained in:
2026-05-15 21:38:14 +02:00
parent c47c46ad64
commit 62221a9baa
+11
View File
@@ -316,6 +316,17 @@ function handleKeyboard(event) {
'%': 'mod', '%': 'mod',
'^': 'pow', '^': 'pow',
}; };
const arrowMap = {
ArrowUp: upButton,
ArrowDown: downButton,
ArrowLeft: leftButton,
ArrowRight: rightButton,
};
if (arrowMap[key]) {
event.preventDefault();
arrowMap[key].click();
return;
}
if (map[key]) { if (map[key]) {
event.preventDefault(); event.preventDefault();
execute(map[key]); execute(map[key]);