diff --git a/app.js b/app.js index 43d20f6..c4a683e 100644 --- a/app.js +++ b/app.js @@ -100,6 +100,7 @@ let scannerRunning = false; let scannerLoopId = null; let scannerLastCodeValue = ""; let scannerLastCodeAt = 0; +let resizeRenderTimeout = null; let selectedGameIds = new Set(); let currentPage = 1; let currentPageGameIds = []; @@ -290,7 +291,27 @@ if (nextPageBtn) { } window.addEventListener("resize", () => { - renderGames(); + // Mobile virtual keyboards trigger resize events. Avoid rerendering while editing, + // otherwise the list rebuild can jump to top and break inline input edits. + if (inlineEditingGameId || editingGameId) { + return; + } + + const active = document.activeElement; + if ( + active instanceof HTMLInputElement || + active instanceof HTMLTextAreaElement || + active instanceof HTMLSelectElement + ) { + return; + } + + if (resizeRenderTimeout) { + clearTimeout(resizeRenderTimeout); + } + resizeRenderTimeout = window.setTimeout(() => { + renderGames(); + }, 120); }); if (v2SearchInput) {