Fix: prevent scroll jump while editing game fields
This commit is contained in:
23
app.js
23
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) {
|
||||
|
||||
Reference in New Issue
Block a user