From 18d47232b739d2995f1ae6bb5aaa8b13fca0e227 Mon Sep 17 00:00:00 2001 From: Yinyin Liu Date: Mon, 13 Apr 2026 10:38:18 +0200 Subject: [PATCH] enter key chains through the battery S/N fields --- .../Information/InformationSodistoreHome.tsx | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/typescript/frontend-marios2/src/content/dashboards/Information/InformationSodistoreHome.tsx b/typescript/frontend-marios2/src/content/dashboards/Information/InformationSodistoreHome.tsx index 1c3d18bd8..eaa605f3b 100644 --- a/typescript/frontend-marios2/src/content/dashboards/Information/InformationSodistoreHome.tsx +++ b/typescript/frontend-marios2/src/content/dashboards/Information/InformationSodistoreHome.tsx @@ -1020,11 +1020,30 @@ function InformationSodistorehome(props: InformationSodistorehomeProps) { {Array.from({ length: batteryCount }, (_, batIdx) => ( handleBatterySnTreeChange(invIdx, clIdx, batIdx, e.target.value) } + onKeyDown={(e) => { + if (e.key === 'Enter' && presetConfig) { + e.preventDefault(); + let nextInv = invIdx, nextCl = clIdx, nextBat = batIdx + 1; + if (nextBat >= presetConfig[invIdx][clIdx]) { + nextBat = 0; + nextCl = clIdx + 1; + if (nextCl >= presetConfig[invIdx].length) { + nextCl = 0; + nextInv = invIdx + 1; + if (nextInv >= presetConfig.length) return; + } + } + const nextId = `bat-${nextInv}-${nextCl}-${nextBat}`; + const nextInput = document.getElementById(nextId) as HTMLInputElement | null; + if (nextInput) nextInput.focus(); + } + }} variant="outlined" fullWidth placeholder={canEdit ? 'Scan or enter serial number' : ''}